Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Structured facts and VGA devices #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions pci_devices.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,29 @@ def add_fact(fact, code)

# To create your own facts, edit the following code:
raid_counter = 0
raidcontrollers=[]
vga_counter = 0
vgacards=[]
devices.each_key do |a|
case devices[a].fetch("Class")
when /^RAID/
add_fact("raidcontroller#{raid_counter}_vendor", "#{devices[a].fetch('Vendor')}")
add_fact("raidcontroller#{raid_counter}_driver", "#{devices[a].fetch('Driver')}")
add_fact("raidcontroller#{raid_counter}_device", "#{devices[a].fetch('Device')}")
raidcontrollers.push(devices[a].fetch('Driver'))
raid_counter += 1
when /^VGA/
add_fact("vgacard#{vga_counter}_vendor", "#{devices[a].fetch('Vendor')}")
add_fact("vgacard#{vga_counter}_device", "#{devices[a].fetch('Device')}")
if(devices[a].has_key?('Module'))
add_fact("vgacard#{vga_counter}_driver", "#{devices[a].fetch('Module')}")
vgacards.push(devices[a].fetch('Module'))
else
vgacards.push(devices[a].fetch('Device'))
end
vga_counter += 1
end
end
add_fact("raidcontrollers",raidcontrollers)
add_fact("vgacards",vgacards)
end