This commit is contained in:
Cayo Puigdefabregas 2024-10-31 10:40:53 +01:00
parent 4b3471d24e
commit 16ba03bd0a
1 changed files with 3 additions and 5 deletions

View File

@ -33,7 +33,7 @@ def get_mac(lshw):
try: try:
get_network_cards(hw, nets) get_network_cards(hw, nets)
except Exception as ss: except Exception as ss:
print("WARNING!! {}".format(ss)) logger.warning("%s", ss)
return return
nets_sorted = sorted(nets, key=lambda x: x['businfo']) nets_sorted = sorted(nets, key=lambda x: x['businfo'])
@ -135,9 +135,7 @@ class Build:
# mac = get_mac2(hwinfo_raw) or "" # mac = get_mac2(hwinfo_raw) or ""
mac = get_mac(lshw) or "" mac = get_mac(lshw) or ""
if not mac: if not mac:
print(f"WARNING: Could not retrieve MAC address in snapshot {snapshot['uuid']}" ) txt = "Could not retrieve MAC address in snapshot %s"
# TODO generate system annotation for that snapshot logger.warning(txt, snapshot['uuid'])
else:
print(f"{manufacturer}{model}{chassis}{serial_number}{sku}{mac}")
return f"{manufacturer}{model}{chassis}{serial_number}{sku}{mac}" return f"{manufacturer}{model}{chassis}{serial_number}{sku}{mac}"