2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-10-20 14:45:45 +00:00

Merge pull request #286 from Obihoernchen/fix/cli-exit-codes

Set the exit code when a read fails
This commit is contained in:
Jarrod Johnson
2026-09-02 10:09:17 -04:00
committed by GitHub
2 changed files with 9 additions and 2 deletions
+1 -1
View File
@@ -327,7 +327,7 @@ async def main():
else:
path = '/noderange/{0}/configuration/system/advanced'.format(
noderange)
rcode = await client.print_attrib_path(path, session, printsys,
rcode |= await client.print_attrib_path(path, session, printsys,
options)
sys.exit(rcode)
+8 -1
View File
@@ -107,7 +107,7 @@ def sensorpass(showout=True, appendtime=False):
if 'error' in reading:
sys.stderr.write('Error: {0}\n'.format(reading['error']))
if 'errorcode' in reading:
exitcode |= exitcode
exitcode |= reading['errorcode']
else:
exitcode |= 1
if 'databynode' not in reading:
@@ -120,6 +120,10 @@ def sensorpass(showout=True, appendtime=False):
sys.stderr.write(
'{0}: Error: {1}\n'.format(node,
reading[node]['error']))
if 'errorcode' in reading[node]:
exitcode |= reading[node]['errorcode']
else:
exitcode |= 1
if 'sensors' not in reading[node]:
continue
for sensedata in reading[node]['sensors']:
@@ -261,3 +265,6 @@ try:
except KeyboardInterrupt:
print('')
sys.exit(0)
# Falling off the end exited 0 whatever sensorpass recorded, so only the
# --interval path ever reported a failed read.
sys.exit(exitcode)