mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-30 06:11:26 -07:00
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:
parent
7a9b5b6fe8
commit
1c185b68be
6 changed files with 25 additions and 20 deletions
|
@ -59,9 +59,6 @@ class Connection(ConnectionBase):
|
|||
raise AnsibleError("Internal Error: this module does not support optimized module pipelining")
|
||||
executable = C.DEFAULT_EXECUTABLE.split()[0] if C.DEFAULT_EXECUTABLE else None
|
||||
|
||||
if sudoable:
|
||||
cmd, self.prompt, self.success_key = self._connection_info.make_become_cmd(cmd)
|
||||
|
||||
self._display.vvv("{0} EXEC {1}".format(self._connection_info.remote_addr, cmd))
|
||||
# FIXME: cwd= needs to be set to the basedir of the playbook
|
||||
debug("opening command with Popen()")
|
||||
|
@ -75,7 +72,7 @@ class Connection(ConnectionBase):
|
|||
)
|
||||
debug("done running command with Popen()")
|
||||
|
||||
if self.prompt and self._connection_info.become_pass:
|
||||
if self._connection_info.prompt and self._connection_info.become_pass:
|
||||
fcntl.fcntl(p.stdout, fcntl.F_SETFL, fcntl.fcntl(p.stdout, fcntl.F_GETFL) | os.O_NONBLOCK)
|
||||
fcntl.fcntl(p.stderr, fcntl.F_SETFL, fcntl.fcntl(p.stderr, fcntl.F_GETFL) | os.O_NONBLOCK)
|
||||
become_output = ''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue