[Pkg-puppet-devel] [SCM] Packaging of Facter for debian branch, upstream, updated. 51bcebe38cab6088c901f1006339bbe40a36d161

Paul Nasrat pnasrat at googlemail.com
Wed Aug 18 05:55:59 UTC 2010


The following commit has been merged in the upstream branch:
commit e9a60bc1d403d280016402199a3d396078577d2c
Author: Marc Fournier <marc.fournier at camptocamp.com>
Date:   Wed May 12 12:51:14 2010 +0200

    Facter::Manufacturer - sunos test + simplified regex
    
    The 2nd regex (with the 0x\d+) got removed because it appears
    to never be used, even on SunOS, for which it has been
    introduced (99833a1b / #1793).
    
    The 3dn regex is changed to clearly confine the value between
    mandatory newlines/whitespaces.

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

-- 
Packaging of Facter for debian



More information about the Pkg-puppet-devel mailing list