1
0
mirror of https://github.com/Napsty/check_esxi_hardware.git synced 2025-04-03 14:43:40 +02:00

Update to newer pywbem exception call

This commit is contained in:
Napsty 2025-02-14 13:50:19 +01:00
parent 6e1e1df61c
commit b06dc7a767

View File

@ -747,10 +747,12 @@ if Version(pywbemversion) >= Version("1.0.0"):
verboseoutput("pywbem is 1.0.0 or newer")
import pywbem._cim_operations as PywbemCimOperations
import pywbem._cim_http as PywbemCimHttp
import pywbem._exceptions as PywbemExceptions
else:
verboseoutput("pywbem is older than 1.0.0")
import pywbem.cim_operations as PywbemCimOperations
import pywbem.cim_http as PywbemCimHttp
import pywbem._exceptions as PywbemExceptions
# Add a timeout for the script. When using with Nagios, the Nagios timeout cannot be < than plugin timeout.
if on_windows == False and timeout > 0:
@ -778,7 +780,7 @@ if vendor=='auto':
sys.exit (ExitUnknown)
else:
verboseoutput("Unknown CIM Error: %s" % args)
except pywbem._exceptions.ConnectionError as args:
except PywbemExceptions.ConnectionError as args:
GlobalStatus = ExitUnknown
print("UNKNOWN: {}".format(args))
sys.exit (GlobalStatus)
@ -813,7 +815,7 @@ for classe in ClassesToCheck :
sys.exit (ExitUnknown)
else:
verboseoutput("Unknown CIM Error: %s" % args)
except pywbem._exceptions.ConnectionError as args:
except PywbemExceptions.ConnectionError as args:
GlobalStatus = ExitUnknown
print("UNKNOWN: {}".format(args))
sys.exit (GlobalStatus)