Rearranging some become stuff in relation to action/connection plugins

Moving the make_sudo_cmd() calls back up to the action level so that connection
plugins don't have to know about it at all, and moving some of the become data
(prompt and success_key) into the ConnectionInformation object so they don't
need to be passed around needlessly.
This commit is contained in:
James Cammarata 2015-06-24 12:12:54 -04:00
parent 7a9b5b6fe8
commit 1c185b68be
6 changed files with 25 additions and 20 deletions

View file

@ -345,13 +345,9 @@ class Connection(ConnectionBase):
ssh_cmd += ['-6']
ssh_cmd.append(self.host)
if sudoable:
cmd, self.prompt, self.success_key = self._connection_info.make_become_cmd(cmd)
ssh_cmd.append(cmd)
self._display.vvv("EXEC {0}".format(' '.join(ssh_cmd)), host=self.host)
self.lock_host_keys(True)
# create process
@ -362,7 +358,7 @@ class Connection(ConnectionBase):
no_prompt_out = ''
no_prompt_err = ''
if self.prompt:
if self._connection_info.prompt:
'''
Several cases are handled for privileges with password
* NOPASSWD (tty & no-tty): detect success_key on stdout