skip device which doesn't have model number #23

Merged
PeterSurda merged 1 commits from swapnil/idlers-agent:main into main 2024-07-05 16:52:53 +02:00

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)