Lines 1-29
Link Here
|
1 |
--- ./lib/ansible/runner/connection_plugins/paramiko_ssh.py.orig 2014-05-23 16:37:57.000000000 -0400 |
|
|
2 |
+++ ./lib/ansible/runner/connection_plugins/paramiko_ssh.py 2014-05-31 09:13:44.137967396 -0400 |
3 |
@@ -31,6 +31,7 @@ |
4 |
import logging |
5 |
import traceback |
6 |
import fcntl |
7 |
+import re |
8 |
import sys |
9 |
from termios import tcflush, TCIFLUSH |
10 |
from binascii import hexlify |
11 |
@@ -210,12 +211,17 @@ |
12 |
shcmd, prompt, success_key = utils.make_sudo_cmd(sudo_user, executable, cmd) |
13 |
elif self.runner.su or su: |
14 |
shcmd, prompt, success_key = utils.make_su_cmd(su_user, executable, cmd) |
15 |
+ prompt_re = re.compile(prompt) |
16 |
vvv("EXEC %s" % shcmd, host=self.host) |
17 |
sudo_output = '' |
18 |
try: |
19 |
chan.exec_command(shcmd) |
20 |
if self.runner.sudo_pass or self.runner.su_pass: |
21 |
- while not sudo_output.endswith(prompt) and success_key not in sudo_output: |
22 |
+ while True: |
23 |
+ if success_key in sudo_output or \ |
24 |
+ (self.runner.sudo_pass and sudo_output.endswith(prompt)) or \ |
25 |
+ (self.runner.su_pass and prompt_re.match(sudo_output)): |
26 |
+ break |
27 |
chunk = chan.recv(bufsize) |
28 |
if not chunk: |
29 |
if 'unknown user' in sudo_output: |