mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-03 12:44:22 -07:00
parent
0286c31e85
commit
d01188033f
5 changed files with 72 additions and 15 deletions
|
@ -225,7 +225,6 @@ class Connection(object):
|
|||
shcmd, prompt, success_key = utils.make_sudo_cmd(sudo_user, executable, cmd)
|
||||
elif self.runner.su or su:
|
||||
shcmd, prompt, success_key = utils.make_su_cmd(su_user, executable, cmd)
|
||||
prompt_re = re.compile(prompt)
|
||||
|
||||
vvv("EXEC %s" % shcmd, host=self.host)
|
||||
sudo_output = ''
|
||||
|
@ -240,7 +239,7 @@ class Connection(object):
|
|||
|
||||
if success_key in sudo_output or \
|
||||
(self.runner.sudo_pass and sudo_output.endswith(prompt)) or \
|
||||
(self.runner.su_pass and prompt_re.match(sudo_output)):
|
||||
(self.runner.su_pass and utils.su_prompts.check_su_prompt(sudo_output)):
|
||||
break
|
||||
chunk = chan.recv(bufsize)
|
||||
|
||||
|
|
|
@ -275,7 +275,6 @@ class Connection(object):
|
|||
|
||||
if su and su_user:
|
||||
sudocmd, prompt, success_key = utils.make_su_cmd(su_user, executable, cmd)
|
||||
prompt_re = re.compile(prompt)
|
||||
ssh_cmd.append(sudocmd)
|
||||
elif not self.runner.sudo or not sudoable:
|
||||
prompt = None
|
||||
|
@ -319,7 +318,7 @@ class Connection(object):
|
|||
while True:
|
||||
if success_key in sudo_output or \
|
||||
(self.runner.sudo_pass and sudo_output.endswith(prompt)) or \
|
||||
(self.runner.su_pass and prompt_re.match(sudo_output)):
|
||||
(self.runner.su_pass and utils.su_prompts.check_su_prompt(sudo_output)):
|
||||
break
|
||||
|
||||
rfd, wfd, efd = select.select([p.stdout, p.stderr], [],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue