Fix ssh state issues by simply assuming it's never connected

This commit is contained in:
James Cammarata 2015-11-24 12:00:37 -05:00
commit 70de8bc96f

View file

@ -60,7 +60,6 @@ class Connection(ConnectionBase):
# management here. # management here.
def _connect(self): def _connect(self):
self._connected = True
return self return self
@staticmethod @staticmethod
@ -284,7 +283,7 @@ class Connection(ConnectionBase):
for l in chunk.splitlines(True): for l in chunk.splitlines(True):
suppress_output = False suppress_output = False
# display.debug("Examining line (source=%s, state=%s): '%s'" % (source, state, l.rstrip('\r\n'))) #display.debug("Examining line (source=%s, state=%s): '%s'" % (source, state, l.rstrip('\r\n')))
if self._play_context.prompt and self.check_password_prompt(l): if self._play_context.prompt and self.check_password_prompt(l):
display.debug("become_prompt: (source=%s, state=%s): '%s'" % (source, state, l.rstrip('\r\n'))) display.debug("become_prompt: (source=%s, state=%s): '%s'" % (source, state, l.rstrip('\r\n')))
self._flags['become_prompt'] = True self._flags['become_prompt'] = True
@ -372,7 +371,7 @@ class Connection(ConnectionBase):
# wait for a password prompt. # wait for a password prompt.
state = states.index('awaiting_prompt') state = states.index('awaiting_prompt')
display.debug('Initial state: %s: %s' % (states[state], self._play_context.prompt)) display.debug('Initial state: %s: %s' % (states[state], self._play_context.prompt))
elif self._play_context.become and self._play_context.success_key and not self._connected: elif self._play_context.become and self._play_context.success_key:
# We're requesting escalation without a password, so we have to # We're requesting escalation without a password, so we have to
# detect success/failure before sending any initial data. # detect success/failure before sending any initial data.
state = states.index('awaiting_escalation') state = states.index('awaiting_escalation')