Skip to content

Commit

Permalink
Merge pull request #29 from xlab-si/move-indicator-led-state
Browse files Browse the repository at this point in the history
Move LED state from server to asset details
  • Loading branch information
agrare authored Sep 14, 2018
2 parents f7417a1 + 771b83c commit ada9fb2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def physical_servers
end

def physical_server_details
rf_client.Systems.Members.collect { |s| get_server_location(s) }
rf_client.Systems.Members.collect { |s| get_server_details(s) }
end

def hardwares
Expand All @@ -14,6 +14,10 @@ def hardwares

private

def get_server_details(server)
get_server_location(server).merge("IndicatorLED" => server.IndicatorLED)
end

def get_server_location(server)
loc = { :server_id => server["@odata.id"] }
return loc if server.Links.Chassis.length.zero?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def physical_servers
:field_replaceable_unit => "dummy",
:raw_power_state => s["PowerState"],
:vendor => "unknown",
:location_led_state => s["IndicatorLED"]
)
persister.computer_systems.build(:managed_entity => server)
end
Expand All @@ -38,13 +37,14 @@ def physical_server_details
collector.physical_server_details.each do |d|
server = persister.physical_servers.lazy_find(d[:server_id])
persister.physical_server_details.build(
:resource => server,
:contact => "",
:description => "",
:location => get_location(d),
:room => "",
:rack_name => get_rack(d),
:lowest_rack_unit => ""
:resource => server,
:contact => "",
:description => "",
:location => get_location(d),
:room => "",
:rack_name => get_rack(d),
:location_led_state => d["IndicatorLED"],
:lowest_rack_unit => ""
)
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def assert_physical_servers
:field_replaceable_unit => "dummy",
:raw_power_state => "Off",
:vendor => "unknown",
:location_led_state => "Off"
)
end

Expand All @@ -55,7 +54,8 @@ def assert_physical_server_details
# TODO(tadeboro): We need better source of data before we can create more
# meaningful test.
expect(d).to have_attributes(
:resource_type => "PhysicalServer"
:location_led_state => "Off",
:resource_type => "PhysicalServer",
)
end

Expand Down

0 comments on commit ada9fb2

Please sign in to comment.