Added a more explicit error when certificate file is not found

This commit is contained in:
2025-07-05 13:17:43 +02:00
parent 9f04afb153
commit 914abf5018

View File

@ -88,8 +88,12 @@ logger.info("========= Synchronization started =========")
try:
airwatch = AirwatchAPI(settings)
airwatch.GetDevices()
devices = airwatch.GetDevices()
logger.info("Airwatch server connection succeeded")
except FileNotFoundError as F:
logger.critical(f"Certificate file not found for CMSURL authentication : {F}")
os.remove(lockFile)
exit(1)
except Exception as error:
logger.critical(f"Connection to Airwatch server failed : {error}")
os.remove(lockFile)
@ -104,9 +108,6 @@ except requests.exceptions.ConnectionError as error:
os.remove(lockFile)
exit(1)
# Recherche des appareils
devices = airwatch.GetDevices()
logger.info(f"Number of devices found in Airwatch : {len(devices)}")
# ====================== Début suppression des doublons ================================= #