-
Notifications
You must be signed in to change notification settings - Fork 15
/
physical_infra_manager.rb
70 lines (57 loc) · 2.04 KB
/
physical_infra_manager.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
module ManageIQ::Providers::CiscoIntersight
class Inventory::Parser::PhysicalInfraManager < Inventory::Parser
def parse
physical_servers
physical_servers_details
# firmwares
end
def physical_servers
collector.physical_servers.each do |s|
# Temporarily setting the values of rack and chassis to nil - as the other two collections are built,
# this is going to be changed by lazy_find function on the id
rack = nil
chassis = nil
persister.physical_servers.build(
:ems_ref => s.device_mo_id,
:health_state => "unknown",
:hostname => "dummy",
:name => s.name,
:physical_chassis => chassis,
:physical_rack => rack,
:power_state => s.admin_power_state,
:raw_power_state => s.oper_power_state,
:type => "ManageIQ::Providers::CiscoIntersight::PhysicalInfraManager::PhysicalServer",
)
end
end
def physical_servers_details
collector.physical_servers.each do |s|
server = persister.physical_servers.lazy_find(s.device_mo_id)
temp = "dummy"
persister.physical_server_details.build(
:description => temp,
:location => temp,
:location_led_state => temp,
:machine_type => temp,
:manufacturer => temp,
:model => s.model,
:product_name => s.name,
:rack_name => s.server_id,
:resource => server,
:room => temp,
:serial_number => s.serial,
)
end
end
def firmwares
collector.firmware_inventory.each do |firmware|
persister.physical_server_firmwares.build(
:resource => nil,
:build => "dummy",
:name => "dummy",
:version => firmware.version
)
end
end
end
end