diff --git a/redfish_utilities/managers.py b/redfish_utilities/managers.py index 3bb4648..5291150 100644 --- a/redfish_utilities/managers.py +++ b/redfish_utilities/managers.py @@ -187,7 +187,7 @@ def print_manager(manager): if property in manager.dict: prop_val = manager.dict[property] if isinstance(prop_val, list): - prop_val = ", ".join(prop_val) + prop_val = ", ".join([i for i in prop_val if i is not None]) elif property == "Status": prop_val = "State: {}, Health: {}".format(prop_val.get("State", "N/A"), prop_val.get("Health", "N/A")) print(manager_line_format.format(property, prop_val)) @@ -514,11 +514,9 @@ def print_manager_network_protocol(network_protocol): if property == "NTP": # For NTP, extract the servers; need to skip "empty" slots potentially if "NTPServers" in network_protocol.dict[property]: - other_str = [] - for server in network_protocol.dict[property]["NTPServers"]: - if isinstance(server, str): - other_str.append(server) - other_str = "NTP Servers: " + ", ".join(other_str) + other_str = "NTP Servers: " + ", ".join( + [i for i in network_protocol.dict[property]["NTPServers"] if i is not None] + ) print( network_protocol_line_format.format( property, @@ -690,7 +688,7 @@ def print_manager_ethernet_interface(interface): if property in interface.dict: prop_val = interface.dict[property] if isinstance(prop_val, list): - prop_val = ", ".join(prop_val) + prop_val = ", ".join([i for i in prop_val if i is not None]) elif property == "Status": prop_val = "State: {}, Health: {}".format(prop_val.get("State", "N/A"), prop_val.get("Health", "N/A")) print(interface_line_format.format(property, prop_val)) diff --git a/redfish_utilities/power_equipment.py b/redfish_utilities/power_equipment.py index 53b0d37..1ff8e15 100644 --- a/redfish_utilities/power_equipment.py +++ b/redfish_utilities/power_equipment.py @@ -403,7 +403,7 @@ def print_power_equipment(power_equipment): if property in power_equipment["Info"].dict: prop_val = power_equipment["Info"].dict[property] if isinstance(prop_val, list): - prop_val = ", ".join(prop_val) + prop_val = ", ".join([i for i in prop_val if i is not None]) elif property == "Status": prop_val = "State: {}, Health: {}".format(prop_val.get("State", "N/A"), prop_val.get("Health", "N/A")) print(power_equipment_line_format.format(property, prop_val)) @@ -534,7 +534,7 @@ def print_power_equipment_electrical(electrical): if property in electrical.dict: prop_val = electrical.dict[property] if isinstance(prop_val, list): - prop_val = ", ".join(prop_val) + prop_val = ", ".join([i for i in prop_val if i is not None]) elif property == "PhaseWiringType": prop_val = str(phase_wiring_type_strings.get(prop_val, prop_val)) elif property == "NominalVoltage": diff --git a/redfish_utilities/systems.py b/redfish_utilities/systems.py index 4cc06ae..8ab678b 100644 --- a/redfish_utilities/systems.py +++ b/redfish_utilities/systems.py @@ -476,7 +476,7 @@ def print_virtual_media(virtual_media_list): if property in virtual_media: prop_val = virtual_media[property] if isinstance(prop_val, list): - prop_val = ", ".join(prop_val) + prop_val = ", ".join([i for i in prop_val if i is not None]) print(virtual_media_line_format.format("", property, prop_val)) print("")