From db456dd9e5ed473b60f8c1f32cd754cd0ad83940 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 16 Apr 2014 10:18:59 -0400 Subject: [PATCH] Have consoles meaningfully retried to see if the target is reconfigured Previously, if a username or password was bad, retry would not occur. Correct this such that every so often or right when someone connects, the target is checked to see if the user/password is now considered good. --- TODO | 2 -- confluent/consoleserver.py | 7 ++----- plugins/hardwaremanagement/ipmi.py | 5 ++--- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/TODO b/TODO index 2c246bc0..921fe425 100644 --- a/TODO +++ b/TODO @@ -37,6 +37,4 @@ Traceback (most recent call last): KeyError: '' --reuse SDR to make health faster -have pyghmi and friends do multiprocessing pools (particularly the PBKDF stuff in auth) --bad password retrie diff --git a/confluent/consoleserver.py b/confluent/consoleserver.py index 9115c2e6..88086b3e 100644 --- a/confluent/consoleserver.py +++ b/confluent/consoleserver.py @@ -107,7 +107,6 @@ class _ConsoleHandler(object): def _got_disconnected(self): self.connecstate = 'unconnected' - eventlet.spawn(self._send_disconnect_events) self._send_rcpts({'connectstate': self.connectstate}) self._connect() @@ -243,10 +242,8 @@ class _ConsoleHandler(object): return (retdata + str(self.buffer[-1024:]), connstate) def write(self, data): - #TODO.... take note of data coming in from audit/log perspective? - #or just let echo take care of it and then we can skip this stack - #level? - self._console.write(data) + if self.connectstate == 'connected': + self._console.write(data) def connect_node(node, configmanager): diff --git a/plugins/hardwaremanagement/ipmi.py b/plugins/hardwaremanagement/ipmi.py index 40b6fbb2..4789122e 100644 --- a/plugins/hardwaremanagement/ipmi.py +++ b/plugins/hardwaremanagement/ipmi.py @@ -104,14 +104,12 @@ class IpmiConsole(conapi.Console): def handle_data(self, data): if type(data) == dict: disconnect = frozenset(('Session Disconnected', 'timeout')) - if 'error' in data and data['error'] in disconnect: + if 'error' in data: self.solconnection = None self.broken = True self.error = data['error'] if self.connected: self.datacallback(conapi.ConsoleEvent.Disconnect) - else: - raise Exception("Unrecognized pyghmi input %s" % repr(data)) else: self.datacallback(data) @@ -134,6 +132,7 @@ class IpmiConsole(conapi.Console): break if self.broken: raise exc.TargetEndpointUnreachable(self.error) + self.connected = True except socket.gaierror as err: raise exc.TargetEndpointUnreachable(str(err))