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

Move LED state from server to asset details #29

Merged
merged 1 commit into from
Sep 14, 2018
Merged
Show file tree
Hide file tree
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
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