Procházet zdrojové kódy

Update 'plugins/edirectory_monitor/libexec/agent_edirectory_monitor'

Michael Honkoop před 3 měsíci
rodič
revize
2ff16522ac

+ 4 - 5
plugins/edirectory_monitor/libexec/agent_edirectory_monitor

@@ -35,17 +35,17 @@ def main():
         l.protocol_version = ldap.VERSION3
     except ldap.LDAPError as e:
         print(f"Failed to initialize LDAP connection: {e}")
-        sys.exit(1)
+        sys.exit(f"Failed to initialize LDAP connection: {e}")
 
     try:
         # Attempt to bind with given credentials
         l.simple_bind_s(binddn, pw)
     except ldap.INVALID_CREDENTIALS:
           print("Authentication to the LDAP host has failed.")
-          sys.exit(1)
+          sys.exit("Authentication to the LDAP host has failed.")
     except ldap.LDAPError as e:
         print(f"LDAP error during bind: {e}")
-        sys.exit(1)
+        sys.exit(f"LDAP error during bind: {e}")
 
     try:
         ldap_result_id = l.search(basedn, searchScope, searchFilter, searchAttribute)
@@ -58,7 +58,6 @@ def main():
             elif result_type == ldap.RES_SEARCH_ENTRY:
                 result_set.append(result_data)
 
-        #print('<<<edirectory_monitor:sep(124)>>>')
         print('<<<edirectory_monitor_agent:sep(124)>>>')
         for i in range(len(result_set)):
             for val in result_set[i]:
@@ -98,7 +97,7 @@ def main():
 
     except ldap.LDAPError as e:
         print(f"LDAP search failed: {e}")
-
+        sys.exit(f"LDAP search failed: {e}")
     finally:
         l.unbind_s()