Skip to content

Commit

Permalink
Merge pull request jhoblitt#18 from razorsedge/MegaCli_NoLog
Browse files Browse the repository at this point in the history
Added -NoLog to MegaCli commandline in facts.
  • Loading branch information
Joshua Hoblitt committed Feb 1, 2014
2 parents f94305d + f9b95b0 commit 860edc7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/facter/megaraid_adapters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
end

# -adpCount sends it's entire output to the stderr
count = Facter::Util::Resolution.exec("#{megacli} -adpCount 2>&1")
count = Facter::Util::Resolution.exec("#{megacli} -adpCount -NoLog 2>&1")
count =~ /Controller Count:\s+(\d+)\./ ? $1 : '0'
end
end
2 changes: 1 addition & 1 deletion lib/facter/megaraid_physical_drives.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# XXX there is no support for handling more than one adapter
pds = []
list = Facter::Util::Resolution.exec("#{megacli} -PDList -aALL")
list = Facter::Util::Resolution.exec("#{megacli} -PDList -aALL -NoLog")
next if list.nil?
list.each_line do |line|
if line =~ /^Device Id:\s+(\d+)/
Expand Down
6 changes: 3 additions & 3 deletions spec/unit/facts/megaraid_adapters_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
it do
Facter.fact(:kernel).stubs(:value).returns('Linux')
Facter.fact(:megacli).stubs(:value).returns('/usr/bin/MegaCli')
Facter::Util::Resolution.stubs(:exec).with('/usr/bin/MegaCli -adpCount 2>&1').
Facter::Util::Resolution.stubs(:exec).with('/usr/bin/MegaCli -adpCount -NoLog 2>&1').
returns(nil)

Facter.fact(:megaraid_adapters).value.should == '0'
Expand All @@ -28,7 +28,7 @@
it 'should find 0 adapters' do
Facter.fact(:kernel).stubs(:value).returns('Linux')
Facter::Util::Resolution.stubs(:which).with('MegaCli').returns('/usr/bin/MegaCli')
Facter::Util::Resolution.stubs(:exec).with('/usr/bin/MegaCli -adpCount 2>&1').
Facter::Util::Resolution.stubs(:exec).with('/usr/bin/MegaCli -adpCount -NoLog 2>&1').
returns(File.read(fixtures('megacli', 'adpcount-count_0')))

Facter.fact(:megaraid_adapters).value.should == '0'
Expand All @@ -37,7 +37,7 @@
it 'should find 1 adapters' do
Facter.fact(:kernel).stubs(:value).returns('Linux')
Facter::Util::Resolution.stubs(:which).with('MegaCli').returns('/usr/bin/MegaCli')
Facter::Util::Resolution.stubs(:exec).with('/usr/bin/MegaCli -adpCount 2>&1').
Facter::Util::Resolution.stubs(:exec).with('/usr/bin/MegaCli -adpCount -NoLog 2>&1').
returns(File.read(fixtures('megacli', 'adpcount-count_1')))

Facter.fact(:megaraid_adapters).value.should == '1'
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/facts/megaraid_physical_drives_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
Facter.fact(:kernel).stubs(:value).returns('Linux')
Facter.fact(:megacli).stubs(:value).returns('/usr/bin/MegaCli')
Facter.fact(:megaraid_adapters).stubs(:value).returns('1')
Facter::Util::Resolution.stubs(:exec).with('/usr/bin/MegaCli -PDList -aALL').
Facter::Util::Resolution.stubs(:exec).with('/usr/bin/MegaCli -PDList -aALL -NoLog').
returns(nil)

Facter.fact(:megaraid_physical_drives).value.should be_nil
Expand All @@ -48,7 +48,7 @@
Facter.fact(:kernel).stubs(:value).returns('Linux')
Facter.fact(:megacli).stubs(:value).returns('/usr/bin/MegaCli')
Facter.fact(:megaraid_adapters).stubs(:value).returns('1')
Facter::Util::Resolution.stubs(:exec).with('/usr/bin/MegaCli -PDList -aALL').
Facter::Util::Resolution.stubs(:exec).with('/usr/bin/MegaCli -PDList -aALL -NoLog').
returns(File.read(fixtures('megacli', 'pdlistaall')))

Facter.fact(:megaraid_physical_drives).value.should == '10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,184,185,188,189,190,192,194,197,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214'
Expand Down

0 comments on commit 860edc7

Please sign in to comment.