From 61a0a66486976eb79f64529b6246a7cf49ae9a99 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 19 Oct 2015 14:09:37 -0400 Subject: [PATCH 1/5] Fix nodelist handling of bad noderange When attributes were specified with an incorrect noderange it was failing to report the noderange error. If that were specifically addressed, it would then proceed to erroneously complain about valid attribute names. --- confluent_client/bin/nodelist | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/confluent_client/bin/nodelist b/confluent_client/bin/nodelist index 9fa5fb3d..d3aa5049 100644 --- a/confluent_client/bin/nodelist +++ b/confluent_client/bin/nodelist @@ -42,6 +42,10 @@ exitcode = 0 if len(args) > 1: seenattributes = set([]) for res in session.read('/noderange/{0}/attributes/all'.format(noderange)): + if 'error' in res: + sys.stderr.write(res['error']) + exitcode = 1 + continue for node in res['databynode']: for attr in res['databynode'][node]: seenattributes.add(attr) @@ -71,11 +75,11 @@ if len(args) > 1: if blamedata: attrout += ' (' + ', '.join(blamedata) + ')' print attrout - - for attr in args[1:]: - if attr not in seenattributes: - sys.stderr.write('Error: {0} not a valid attribute\n'.format(attr)) - exitcode = 1 + if not exitcode: + for attr in args[1:]: + if attr not in seenattributes: + sys.stderr.write('Error: {0} not a valid attribute\n'.format(attr)) + exitcode = 1 else: for res in session.read(nodelist): if 'error' in res: From 76906c191bc0249e8858fa3487cc788bb2e15345 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 19 Oct 2015 14:13:02 -0400 Subject: [PATCH 2/5] Replace '/' in '-' in ipmi names '/' confuses our '/' delimited namespace. Use '-' instead. '_or_' was considered, but other meanings could be applied other than '/'. --- confluent_server/confluent/plugins/hardwaremanagement/ipmi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py index 31630c2e..b6407993 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py @@ -58,7 +58,7 @@ def hex2bin(hexstring): return bytearray(bytedata) def simplify_name(name): - return name.lower().replace(' ', '_') + return name.lower().replace(' ', '_').replace('/', '-') def sanitize_invdata(indata): From 204f6de7e90ace5953a51d7ce4571f70008840ff Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 19 Oct 2015 14:14:54 -0400 Subject: [PATCH 3/5] Fix missing 'nodeeventlog' command in packaging When packaging, nodeeventlog was missed. Fix the setup.py.tmpl to include the missing script. --- confluent_client/setup.py.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/confluent_client/setup.py.tmpl b/confluent_client/setup.py.tmpl index 6b1f4e35..a4bd1684 100644 --- a/confluent_client/setup.py.tmpl +++ b/confluent_client/setup.py.tmpl @@ -7,6 +7,6 @@ setup( author_email='jjohnson2@lenovo.com', url='http://xcat.sf.net/', packages=['confluent'], - scripts=['bin/confetty', 'bin/nodeconsole', 'bin/nodehealth', 'bin/nodeidentify', 'bin/nodelist', 'bin/nodepower', 'bin/nodesensors', 'bin/nodesetboot'], + scripts=['bin/confetty', 'bin/nodeconsole', 'bin/nodeeventlog', 'bin/nodehealth', 'bin/nodeidentify', 'bin/nodelist', 'bin/nodepower', 'bin/nodesensors', 'bin/nodesetboot'], data_files=[('/etc/profile.d', ['confluent_env.sh'])], ) From dec0543ce310c2d86b8f216358f54d5dfc492200 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 19 Oct 2015 14:23:02 -0400 Subject: [PATCH 4/5] Fix nodelist formatting of error Error needed a newline after message to be clear. --- confluent_client/bin/nodelist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/confluent_client/bin/nodelist b/confluent_client/bin/nodelist index d3aa5049..fdd354f7 100644 --- a/confluent_client/bin/nodelist +++ b/confluent_client/bin/nodelist @@ -43,7 +43,7 @@ if len(args) > 1: seenattributes = set([]) for res in session.read('/noderange/{0}/attributes/all'.format(noderange)): if 'error' in res: - sys.stderr.write(res['error']) + sys.stderr.write(res['error'] + '\n') exitcode = 1 continue for node in res['databynode']: From e153e8acd0cd8fad610019d2aabe842185285546 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 19 Oct 2015 14:27:11 -0400 Subject: [PATCH 5/5] Correct indentation in nodeeventlog Mistakes were present in the whitespace for nodeeventlog, apply correct indentation. --- confluent_client/bin/nodeeventlog | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/confluent_client/bin/nodeeventlog b/confluent_client/bin/nodeeventlog index ed4742c6..b204c5be 100644 --- a/confluent_client/bin/nodeeventlog +++ b/confluent_client/bin/nodeeventlog @@ -74,13 +74,13 @@ for rsp in func('/noderange/{0}/events/hardware/log'.format(noderange)): sys.stderr.write(rsp['error'] + '\n') exitcode |= rsp['errorcode'] if 'databynode' in rsp: - nodedata = rsp['databynode'] - for node in nodedata: - thisdata = nodedata[node] + nodedata = rsp['databynode'] + for node in nodedata: + thisdata = nodedata[node] if 'error' in thisdata: sys.stderr.write('{0}: {1}\n'.format(node, thisdata['error'])) exitcode |= 1 - if 'events' in thisdata: + if 'events' in thisdata: evtdata = thisdata['events'] for evt in evtdata: print '{0}: {1}'.format(node, format_event(evt)) \ No newline at end of file