forked from puppetlabs/facter
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove whitespace in DMI facts (#3008, #3011)
In addition to the stripping of the output of these facts this patchset: Refactor - Extracted function to enable easier testing. Tests - data driven tests for the dmidecode/smbios fact. Paul
- Loading branch information
Paul Nasrat
committed
Jan 10, 2010
1 parent
feecd39
commit 356cf15
Showing
3 changed files
with
97 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# dmidecode 2.2 | ||
SMBIOS 2.3 present. | ||
32 structures occupying 994 bytes. | ||
Table at 0x000F0800. | ||
Handle 0x0000 | ||
DMI type 0, 20 bytes. | ||
BIOS Information | ||
Vendor: Award Software International, Inc. | ||
Version: 6.00 PG | ||
Release Date: 01/03/2003 | ||
Address: 0xE0000 | ||
Runtime Size: 128 kB | ||
ROM Size: 256 kB | ||
Characteristics: | ||
ISA is supported | ||
PCI is supported | ||
PNP is supported | ||
APM is supported | ||
BIOS is upgradeable | ||
BIOS shadowing is allowed | ||
ESCD support is available | ||
Boot from CD is supported | ||
Selectable boot is supported | ||
BIOS ROM is socketed | ||
EDD is supported | ||
5.25"/360 KB floppy services are supported (int 13h) | ||
5.25"/1.2 MB floppy services are supported (int 13h) | ||
3.5"/720 KB floppy services are supported (int 13h) | ||
3.5"/2.88 MB floppy services are supported (int 13h) | ||
Print screen service is supported (int 5h) | ||
8042 keyboard services are supported (int 9h) | ||
Serial services are supported (int 14h) | ||
Printer services are supported (int 17h) | ||
CGA/mono video services are supported (int 10h) | ||
ACPI is supported | ||
USB legacy is supported | ||
AGP is supported | ||
LS-120 boot is supported | ||
ATAPI Zip drive boot is supported | ||
Handle 0x0001 | ||
DMI type 1, 25 bytes. | ||
System Information | ||
Manufacturer: MICRO-STAR INTERNATIONAL CO., LTD | ||
Product Name: MS-6754 | ||
Version: | ||
Serial Number: | ||
UUID: Not Present | ||
Wake-up Type: Power Switch | ||
Handle 0x0002 | ||
DMI type 2, 8 bytes. | ||
Base Board Information | ||
Manufacturer: MICRO-STAR INTERNATIONAL CO., LTD | ||
Product Name: MS-6754 | ||
Version: | ||
Serial Number: | ||
|
||
Handle 0x001F | ||
DMI type 127, 4 bytes. | ||
End Of Table | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
require File.dirname(__FILE__) + '/../../spec_helper' | ||
|
||
require 'facter/util/manufacturer' | ||
|
||
describe Facter::Manufacturer do | ||
it "should return the system DMI table" do | ||
Facter::Manufacturer.should respond_to(:get_dmi_table) | ||
end | ||
|
||
it "should return nil on non-supported operating systems" do | ||
Facter.stubs(:value).with(:kernel).returns("SomeThing") | ||
Facter::Manufacturer.get_dmi_table().should be_nil | ||
end | ||
|
||
it "should strip white space on dmi output with spaces" do | ||
sample_output_file = File.dirname(__FILE__) + "/../data/linux_dmidecode_with_spaces" | ||
dmidecode_output = File.new(sample_output_file).read() | ||
Facter::Manufacturer.expects(:get_dmi_table).returns(dmidecode_output) | ||
Facter.fact(:kernel).stubs(:value).returns("Linux") | ||
|
||
query = { '[Ss]ystem [Ii]nformation' => [ { 'Product(?: Name)?:' => 'productname' } ] } | ||
|
||
Facter::Manufacturer.dmi_find_system_info(query) | ||
Facter.value(:productname).should == "MS-6754" | ||
end | ||
end |