2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-17 13:13:18 +00:00

Avoid double connect on shell start

When a shell session is initiated, it registers
a recipient at the same time it would be trying
to establish session for not being a 'wait for
recipient'.  Aggressively mark the state as connecting
to avoid the recipient erroneously thinking things have
not be set into motion yet.  Additionally, have the ssh
plugin avoid a traceback when disconnecting before completing
connection.
This commit is contained in:
Jarrod Johnson 2016-01-07 10:30:30 -05:00
parent cfafa5a5bc
commit a332678312
2 changed files with 4 additions and 1 deletions

View File

@ -89,6 +89,7 @@ class ConsoleHandler(object):
(self.node,), self._genwatchattribs, self._attribschanged)
self.check_isondemand()
if not self._isondemand:
self.connectstate = 'connecting'
eventlet.spawn(self._connect)
def check_isondemand(self):

View File

@ -29,6 +29,7 @@ class SshShell(conapi.Console):
def __init__(self, node, config, username='', password=''):
self.node = node
self.ssh = None
self.nodeconfig = config
self.username = username
self.password = password
@ -96,7 +97,8 @@ class SshShell(conapi.Console):
self.shell.sendall(data)
def close(self):
self.ssh.close()
if self.ssh is not None:
self.ssh.close()
def create(nodes, element, configmanager, inputdata):
if len(nodes) == 1: