2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-01-04 15:12:29 +00:00

Fix noderun in same way as nodeshell

noderun had a similar issue about error handling.
This commit is contained in:
Jarrod Johnson
2017-08-03 08:40:58 -04:00
parent 5d7df6dceb
commit 05715c6826
2 changed files with 7 additions and 5 deletions

View File

@@ -59,7 +59,10 @@ def run():
for exp in c.create('/noderange/{0}/attributes/expression'.format(args[0]),
{'expression': cmdstr}):
ex = exp['databynode']
if 'error' in exp:
sys.stderr.write(exp['error'] + '\n')
exitcode |= exp.get('errorcode', 1)
ex = exp.get('databynode', ())
for node in ex:
cmd = ex[node]['value'].encode('utf-8')
cmdv = shlex.split(cmd)
@@ -68,7 +71,8 @@ def run():
run_cmdv(node, cmdv, all, pipedesc)
else:
pendingexecs.append((node, cmdv))
if not all or exitcode:
sys.exit(exitcode)
exitcode = 0
rdy, _, _ = select.select(all, [], [], 10)
while all:

View File

@@ -72,9 +72,7 @@ def run():
run_cmdv(node, cmdv, all, pipedesc)
else:
pendingexecs.append((node, cmdv))
if not all:
sys.exit(exitcode)
if exitcode:
if not all or exitcode
sys.exit(exitcode)
rdy, _, _ = select.select(all, [], [], 10)
while all: