From 675dc966c7d7da926ec803e0055ba1455bf69dc1 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 17 May 2018 16:24:06 -0400 Subject: [PATCH] Clean up errors on bad ipv4 addresses confluent errors are better now --- confluent_client/bin/nodeconfig | 4 ---- .../plugins/hardwaremanagement/ipmi.py | 18 ++++++++++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/confluent_client/bin/nodeconfig b/confluent_client/bin/nodeconfig index 170fe335..e0f19885 100755 --- a/confluent_client/bin/nodeconfig +++ b/confluent_client/bin/nodeconfig @@ -191,10 +191,6 @@ if setmode: for node in fr.get('databynode', []): r = fr['databynode'][node] exitcode |= client.printerror(r, node) - if 'error' in r: - sys.stderr.write(node + ': ' + r['error'] + '\n') - if 'errorcode' in r: - rcode |= r['errorcode'] if 'value' not in r: continue keyval = r['value'] diff --git a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py index ae93d8e9..e2e9ecd6 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py @@ -597,10 +597,20 @@ class IpmiHandler(object): )) elif self.op == 'update': config = self.inputdata.netconfig(self.node) - self.ipmicmd.set_net_configuration( - ipv4_address=config['ipv4_address'], - ipv4_configuration=config['ipv4_configuration'], - ipv4_gateway=config['ipv4_gateway']) + try: + self.ipmicmd.set_net_configuration( + ipv4_address=config['ipv4_address'], + ipv4_configuration=config['ipv4_configuration'], + ipv4_gateway=config['ipv4_gateway']) + except socket.error as se: + self.output.put(msg.ConfluentNodeError(self.node, + se.message)) + except ValueError as e: + if e.message == 'negative shift count': + self.output.put(msg.ConfluentNodeError( + self.node, 'Invalid prefix length given')) + else: + raise def handle_users(self): # Create user