2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 09:32:21 +00:00

Fix confusing nodeconfig error handling

Properly react to error conditions
This commit is contained in:
Jarrod Johnson 2018-06-01 16:48:19 -04:00
parent a560dc1974
commit daef9fa60b
2 changed files with 12 additions and 4 deletions

View File

@ -202,12 +202,14 @@ else:
for path in queryparms:
if options.comparedefault:
continue
client.print_attrib_path(path, session, list(queryparms[path]),
NullOpt(), queryparms[path])
rc = client.print_attrib_path(path, session, list(queryparms[path]),
NullOpt(), queryparms[path])
if rc:
sys.exit(rc)
if printsys or options.exclude:
if printsys == 'all':
printsys = []
path = '/noderange/{0}/configuration/system/all'.format(noderange)
client.print_attrib_path(path, session, printsys,
options)
rcode = client.print_attrib_path(path, session, printsys,
options)
sys.exit(rcode)

View File

@ -338,6 +338,12 @@ def print_attrib_path(path, session, requestargs, options, rename=None):
for attr, val in sorted(
res['databynode'][node].items(),
key=lambda (k, v): v.get('sortid', k) if isinstance(v, dict) else k):
if attr == 'error':
sys.stderr.write('{0}: Error: {1}\n'.format(node, val))
continue
if attr == 'errorcode':
exitcode |= val
continue
seenattributes.add(attr)
if rename:
printattr = rename.get(attr, attr)