[Pkg-puppet-devel] [SCM] Packaging of Facter for debian branch, upstream, updated. 51bcebe38cab6088c901f1006339bbe40a36d161
Paul Nasrat
pnasrat at googlemail.com
Wed Aug 18 05:55:58 UTC 2010
The following commit has been merged in the upstream branch:
commit be411c00ee47e62bf0408dbb7c93c8dc6a9d9381
Author: Marc Fournier <marc.fournier at camptocamp.com>
Date: Tue May 11 09:12:08 2010 +0200
Facter::Manufacturer - test for SunOS and FreeBSD
This test compares a fact made with dmidecode (linux and bsd) with one using
smbios (solaris).
diff --git a/spec/unit/data/freebsd_dmidecode b/spec/unit/data/freebsd_dmidecode
new file mode 100644
index 0000000..d765942
--- /dev/null
+++ b/spec/unit/data/freebsd_dmidecode
@@ -0,0 +1,42 @@
+# dmidecode 2.10
+SMBIOS 2.5 present.
+5 structures occupying 352 bytes.
+Table at 0x000E1000.
+
+Handle 0x0000, DMI type 0, 20 bytes
+BIOS Information
+ Vendor: innotek GmbH
+ Version: VirtualBox
+ Release Date: 12/01/2006
+ Address: 0xE0000
+ Runtime Size: 128 kB
+ ROM Size: 128 kB
+ Characteristics:
+ ISA is supported
+ PCI is supported
+ Boot from CD is supported
+ Selectable boot is supported
+ 8042 keyboard services are supported (int 9h)
+ CGA/mono video services are supported (int 10h)
+ ACPI is supported
+
+Handle 0x0001, DMI type 1, 27 bytes
+System Information
+ Manufacturer: innotek GmbH
+ Product Name: VirtualBox
+ Version: 1.2
+ Serial Number: 0
+ UUID: 3BD58031-AE9E-4F06-8A57-941942861939
+ Wake-up Type: Power Switch
+ SKU Number: Not Specified
+ Family: Virtual Machine
+
+Handle 0x0003, DMI type 126, 13 bytes
+Inactive
+
+Handle 0x0002, DMI type 126, 7 bytes
+Inactive
+
+Handle 0xFEFF, DMI type 127, 147 bytes
+End Of Table
+
diff --git a/spec/unit/data/opensolaris_smbios b/spec/unit/data/opensolaris_smbios
new file mode 100644
index 0000000..68f1004
--- /dev/null
+++ b/spec/unit/data/opensolaris_smbios
@@ -0,0 +1,33 @@
+ID SIZE TYPE
+0 54 SMB_TYPE_BIOS (BIOS information)
+
+ Vendor: innotek GmbH
+ Version String: VirtualBox
+ Release Date: 12/01/2006
+ Address Segment: 0xe000
+ ROM Size: 131072 bytes
+ Image Size: 131072 bytes
+ Characteristics: 0x48018090
+ SMB_BIOSFL_ISA (ISA is supported)
+ SMB_BIOSFL_PCI (PCI is supported)
+ SMB_BIOSFL_CDBOOT (Boot from CD is supported)
+ SMB_BIOSFL_SELBOOT (Selectable Boot supported)
+ SMB_BIOSFL_I9_KBD (int 0x9 8042 keyboard svcs)
+ SMB_BIOSFL_I10_CGA (int 0x10 CGA svcs)
+ Characteristics Extension Byte 1: 0x1
+ SMB_BIOSXB1_ACPI (ACPI is supported)
+ Characteristics Extension Byte 2: 0x0
+
+ID SIZE TYPE
+1 72 SMB_TYPE_SYSTEM (system information)
+
+ Manufacturer: innotek GmbH
+ Product: VirtualBox
+ Version: 1.2
+ Serial Number: 0
+
+ UUID: cf4bff06-0b33-4891-bda0-5ec17bea5511
+ Wake-Up Event: 0x6 (power switch)
+ SKU Number:
+ Family: Virtual Machine
+
diff --git a/spec/unit/util/manufacturer.rb b/spec/unit/util/manufacturer.rb
index 74660f7..07e3ffb 100644
--- a/spec/unit/util/manufacturer.rb
+++ b/spec/unit/util/manufacturer.rb
@@ -83,4 +83,27 @@ Handle 0x001F
Facter::Manufacturer.dmi_find_system_info(query)
Facter.value(:ramlocation).should == "System Board Or Motherboard"
end
+
+ def find_product_name(os)
+ output_file = case os
+ when "FreeBSD": File.dirname(__FILE__) + "/../data/freebsd_dmidecode"
+ when "SunOS" : File.dirname(__FILE__) + "/../data/opensolaris_smbios"
+ end
+
+ output = File.new(output_file).read()
+ query = { '[Ss]ystem [Ii]nformation' => [ { 'Product(?: Name)?:' => "product_name_#{os}" } ] }
+
+ Facter.fact(:kernel).stubs(:value).returns(os)
+ Facter::Manufacturer.expects(:get_dmi_table).returns(output)
+
+ Facter::Manufacturer.dmi_find_system_info(query)
+
+ return Facter.value("product_name_#{os}")
+ end
+
+ it "should return the same result with smbios than with dmidecode" do
+ find_product_name("FreeBSD").should_not == nil
+ find_product_name("FreeBSD").should == find_product_name("SunOS")
+ end
+
end
--
Packaging of Facter for debian
More information about the Pkg-puppet-devel
mailing list