diff --git a/scripts/StagingUserAssignation.py b/scripts/StagingUserAssignation.py index 80403b3..3d82e0b 100644 --- a/scripts/StagingUserAssignation.py +++ b/scripts/StagingUserAssignation.py @@ -142,9 +142,15 @@ for device in devices: else: logger.warning(f"Device with id {device.Id} is not assigned to any user in GLPI, skipping the device") elif(deviceCount > 1): - logger.info(f"More than one entry found in GLPI for device with id {device.Id}") + logger.error(f"{count} devices matching airwatch device {device.FriendlyName} (Airwatch id={device.Id}) in GLPI trashbin (GLPI ids = {', '.join(deviceID)}), skipping this device...") else: - logger.error(f"Device {device.Id} with serialnumber {device.SerialNumber} not found in GLPI (in trash bin ?)") + deviceIDTrash, dataTrash, deviceCountTrash = glpiapi.GetDevice(device, trashbin=True) + if(countTrash > 1): + logger.error(f"{countTrash} devices matching airwatch device {device.FriendlyName} (Airwatch id={device.Id}) in GLPI trashbin (GLPI ids = {', '.join(deviceIDTrash)}), skipping this device...") + elif(countTrash == 1): + logger.warning(f"Device {device.FriendlyName} (Airwatch id={device.Id}) in GLPI trashbin (GLPI id={deviceIDTrash}), skipping...") + else: + logger.error(f"Device {device.FriendlyName} (Airwatch id={device.Id}) not found in GLPI.") # Suppression du verrou