From 8d4b83159e4f8362e1c8e19e80f22079a5a0f547 Mon Sep 17 00:00:00 2001 From: Quentin Moss Date: Tue, 9 Aug 2016 16:39:30 -0700 Subject: [PATCH] Add limit to mysql server ID generated value --- lib/facter/mysql_server_id.rb | 2 +- spec/unit/facter/mysql_server_id_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/facter/mysql_server_id.rb b/lib/facter/mysql_server_id.rb index df0052f..3cb39e5 100644 --- a/lib/facter/mysql_server_id.rb +++ b/lib/facter/mysql_server_id.rb @@ -1,5 +1,5 @@ def get_mysql_id - Facter.value(:macaddress).split(':').inject(0) { |total,value| (total << 6) + value.hex } + Facter.value(:macaddress).split(':')[2..-1].inject(0) { |total,value| (total << 6) + value.hex } end Facter.add("mysql_server_id") do diff --git a/spec/unit/facter/mysql_server_id_spec.rb b/spec/unit/facter/mysql_server_id_spec.rb index e82a2bc..a2e9fdf 100644 --- a/spec/unit/facter/mysql_server_id_spec.rb +++ b/spec/unit/facter/mysql_server_id_spec.rb @@ -11,7 +11,7 @@ describe Facter::Util::Fact do Facter.fact(:macaddress).stubs(:value).returns('3c:97:0e:69:fb:e1') end it do - Facter.fact(:mysql_server_id).value.to_s.should == '66961985441' + Facter.fact(:mysql_server_id).value.to_s.should == '4116385' end end