diff --git a/confluent_client/bin/nodeboot b/confluent_client/bin/nodeboot index ee1f4eba..6edd7bf9 100755 --- a/confluent_client/bin/nodeboot +++ b/confluent_client/bin/nodeboot @@ -61,11 +61,11 @@ if options.biosmode: else: bootmode = 'uefi' +errnodes = set([]) rc = session.simple_noderange_command(noderange, '/boot/nextdevice', bootdev, bootmode=bootmode, - persistent=options.persist) - -if rc: - sys.exit(rc) -else: - sys.exit(session.simple_noderange_command(noderange, '/power/state', 'boot')) \ No newline at end of file + persistent=options.persist, + errnodes=errnodes) +noderange = noderange + ',-(' + ','.join(errnodes) + ')' +rc |= session.simple_noderange_command(noderange, '/power/state', 'boot') +sys.exit(rc) diff --git a/confluent_client/confluent/client.py b/confluent_client/confluent/client.py index 1936ab89..f9283dd0 100644 --- a/confluent_client/confluent/client.py +++ b/confluent_client/confluent/client.py @@ -77,7 +77,7 @@ class Command(object): def add_precede_key(self, keyname): self._prevkeyname = keyname - def handle_results(self, ikey, rc, res): + def handle_results(self, ikey, rc, res, errnodes=None): if 'error' in res: sys.stderr.write('Error: {0}\n'.format(res['error'])) if 'errorcode' in res: @@ -89,6 +89,8 @@ class Command(object): res = res['databynode'] for node in res: if 'error' in res[node]: + if errnodes is not None: + errnodes.add(node) sys.stderr.write('{0}: Error: {1}\n'.format( node, res[node]['error'])) if 'errorcode' in res[node]: @@ -110,7 +112,7 @@ class Command(object): return rc def simple_noderange_command(self, noderange, resource, input=None, - key=None, **kwargs): + key=None, errnodes=None, **kwargs): try: rc = 0 if resource[0] == '/': @@ -123,12 +125,12 @@ class Command(object): if input is None: for res in self.read('/noderange/{0}/{1}'.format( noderange, resource)): - rc = self.handle_results(ikey, rc, res) + rc = self.handle_results(ikey, rc, res, errnodes) else: kwargs[ikey] = input for res in self.update('/noderange/{0}/{1}'.format( noderange, resource), kwargs): - rc = self.handle_results(ikey, rc, res) + rc = self.handle_results(ikey, rc, res, errnodes) return rc except KeyboardInterrupt: print('')