skip device which doesn't have model number

This commit is contained in:
Swapnil 2024-07-05 18:42:18 +05:30
parent 75744e0010
commit 601bed9a34
Signed by: swapnil
GPG Key ID: 58029C48BB100574

View File

@ -124,7 +124,12 @@ class ServerData:
# Parse the output # Parse the output
details = {} details = {}
details['model_number'] = re.search(r'Model Number:\s*(.*)', output).group(1) model_number_match = re.search(r'Model Number:\s*(.*)', output)
if model_number_match is None:
logging.warning("Skipping device {} as it does not have a model number".format(device))
continue
details['model_number'] = model_number_match.group(1)
details['serial_number'] = re.search(r'Serial Number:\s*(.*)', output).group(1) details['serial_number'] = re.search(r'Serial Number:\s*(.*)', output).group(1)
details['firmware_revision'] = re.search(r'Firmware Revision:\s*(.*)', output).group(1) details['firmware_revision'] = re.search(r'Firmware Revision:\s*(.*)', output).group(1)
details['transport'] = re.search(r'Transport:\s*(.*)', output).group(1) details['transport'] = re.search(r'Transport:\s*(.*)', output).group(1)