From 5d7fadf6156c01cab83c6d03ca8fb5ae350cc078 Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Mon, 31 Aug 2026 22:09:23 +0200 Subject: [PATCH] Set the exit code when a read fails nodesensors and nodeconfig printed an error and exited 0, so `nodesensors n1 && next-step` ran next-step after the read it guarded had already failed. nodesensors had three of these: the per-node branch never set the exit code, the top-level branch beside it read `exitcode |= exitcode`, and a normal return from main() fell off the end of the file. nodeconfig accumulates with |= all through its read path except the last line, which assigned, so a failed bmc configuration read was discarded by the system read after it. The fixed branches now match how nodehealth and client.py spell the same thing. --- confluent_client/bin/nodeconfig | 2 +- confluent_client/bin/nodesensors | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/confluent_client/bin/nodeconfig b/confluent_client/bin/nodeconfig index 4746c4b6..9c84fb0e 100755 --- a/confluent_client/bin/nodeconfig +++ b/confluent_client/bin/nodeconfig @@ -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) diff --git a/confluent_client/bin/nodesensors b/confluent_client/bin/nodesensors index 0130e800..40fc8e7b 100755 --- a/confluent_client/bin/nodesensors +++ b/confluent_client/bin/nodesensors @@ -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)