1
0
mirror of https://github.com/Napsty/check_esxi_hardware.git synced 2026-02-05 22:55:17 +01:00

Change exit code from -1/255 to 3 to match Nagios plugin specs (#76)

This commit is contained in:
Peter Newman
2025-07-16 06:50:52 +01:00
committed by GitHub
parent 8b6917f0ca
commit 6a41af4a60

View File

@@ -607,14 +607,14 @@ def getopts() :
if len(sys.argv) < 2: if len(sys.argv) < 2:
print("no parameters specified\n") print("no parameters specified\n")
parser.print_help() parser.print_help()
sys.exit(-1) sys.exit(3)
# if first argument starts with 'https://' we have old-style parameters, so handle in old way # if first argument starts with 'https://' we have old-style parameters, so handle in old way
if re.match("https://",sys.argv[1]): if re.match("https://",sys.argv[1]):
# check input arguments # check input arguments
if len(sys.argv) < 5: if len(sys.argv) < 5:
print("too few parameters\n") print("too few parameters\n")
parser.print_help() parser.print_help()
sys.exit(-1) sys.exit(3)
if len(sys.argv) > 5 : if len(sys.argv) > 5 :
if sys.argv[5] == "verbose" : if sys.argv[5] == "verbose" :
verbose = True verbose = True
@@ -632,7 +632,7 @@ def getopts() :
if not options.__dict__[m]: if not options.__dict__[m]:
print("mandatory option '" + m + "' not defined. read usage in help.\n") print("mandatory option '" + m + "' not defined. read usage in help.\n")
parser.print_help() parser.print_help()
sys.exit(-1) sys.exit(3)
hostname=options.host.lower() hostname=options.host.lower()
# if user has put "https://" in front of hostname out of habit, do the right thing # if user has put "https://" in front of hostname out of habit, do the right thing