diff options
-rw-r--r-- | lib/facter/util/manufacturer.rb | 2 | ||||
-rw-r--r-- | spec/unit/util/manufacturer.rb | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/facter/util/manufacturer.rb b/lib/facter/util/manufacturer.rb index b781e12..112380b 100644 --- a/lib/facter/util/manufacturer.rb +++ b/lib/facter/util/manufacturer.rb @@ -35,7 +35,7 @@ module Facter::Manufacturer v.each do |v2| v2.each_pair do |value,facterkey| output.split(splitstr).each do |line| - if line =~ /#{key}/ and ( line =~ /#{value} 0x\d+ \(([-\w].*)\)\n*/ or line =~ /#{value} ([-\w].*)\n*/ ) + if line =~ /#{key}/ and line =~ /\n\s+#{value} (.+)\n/ result = $1.strip Facter.add(facterkey) do confine :kernel => [ :linux, :freebsd, :netbsd, :sunos ] diff --git a/spec/unit/util/manufacturer.rb b/spec/unit/util/manufacturer.rb index 07e3ffb..c0d4b13 100644 --- a/spec/unit/util/manufacturer.rb +++ b/spec/unit/util/manufacturer.rb @@ -24,6 +24,18 @@ describe Facter::Manufacturer do Facter.value(:productname).should == "MS-6754" end + it "should handle output from smbios when run under sunos" do + sample_output_file = File.dirname(__FILE__) + "/../data/opensolaris_smbios" + smbios_output = File.new(sample_output_file).read() + Facter::Manufacturer.expects(:get_dmi_table).returns(smbios_output) + Facter.fact(:kernel).stubs(:value).returns("SunOS") + + query = { 'BIOS information' => [ { 'Release Date:' => 'reldate' } ] } + + Facter::Manufacturer.dmi_find_system_info(query) + Facter.value(:reldate).should == "12/01/2006" + end + it "should not split on dmi keys containing the string Handle" do dmidecode_output = <<-eos Handle 0x1000, DMI type 16, 15 bytes |