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

Add repairability to the inventory catalog #84

Closed
wants to merge 1 commit into from
Closed
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
15 changes: 14 additions & 1 deletion redfish_utilities/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,18 @@ def catalog_resource( context, resource, inventory, chassis_id ):
if resource_type == "Drive":
location_prop = "PhysicalLocation"

# Determine whether this unit can be replaced
replaceable = None
if resource_type == "Chassis" or resource_type == "Processor":
replaceable = resource.get("Replaceable", None )
if not replaceable:
location_type = resource.get( location_prop, {} ).get( "PartLocation", {} ).get( "LocationType", None )
if location_type:
if location_type == "Embedded":
replaceable = False
else:
replaceable = True

# Pull out all relevant properties for the catalog
catalog = {
"Uri": resource["@odata.id"],
Expand All @@ -207,7 +219,8 @@ def catalog_resource( context, resource, inventory, chassis_id ):
"AssetTag": resource.get( "AssetTag", None ),
"Label": resource.get( location_prop, {} ).get( "PartLocation", {} ).get( "ServiceLabel", None ),
"State": resource.get( "Status", {} ).get( "State", None ),
"Description": None
"Description": None,
"Replaceable": replaceable
}

# If no label was found, build a default name
Expand Down