From ef68656bdee2d15a9a0d2e25e868b9e6d1fd0c11 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 3 Dec 2019 10:04:34 -0500 Subject: [PATCH] Fix nodestorage handling of error Error messages were not properly handled if specific nodes had issues. Properly provide the error messages. Additionally, clarify a common uselessly vague error. --- confluent_client/bin/nodestorage | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/confluent_client/bin/nodestorage b/confluent_client/bin/nodestorage index b6d536c1..862417e1 100644 --- a/confluent_client/bin/nodestorage +++ b/confluent_client/bin/nodestorage @@ -63,10 +63,16 @@ def _print_cfg(scfg): sys.stderr.write(e['error'] + '\n') exitcode = e.get('errorcode', 1) for node in e.get('databynode', {}): + curr = e['databynode'][node] + if 'error' in curr: + if 'no available drives' in curr['error']: + curr['error'] += ' (drives must be in unconfigured state to be available, they must not be in jbod or online state)' + sys.stderr.write('{0}: {1}\n'.format(node, curr['error'])) + exitcode = curr.get('errorcode', 1) + continue if node not in storagebynode: storagebynode[node] = {'disks': [], 'arrays': [], 'volumes': []} - curr = e['databynode'][node] storagebynode[node][curr['type'] + 's'].append(curr) for node in storagebynode: for disk in sorted(storagebynode[node]['disks'],