|
|
@ -98,16 +98,12 @@ class SSHConnection(object):
|
|
|
|
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
|
|
|
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
|
|
|
|
|
|
|
|
|
|
|
# We can't use p.communicate here because the ControlMaster may have stdout open as well
|
|
|
|
# We can't use p.communicate here because the ControlMaster may have stdout open as well
|
|
|
|
p.stdin.close()
|
|
|
|
|
|
|
|
stdout = ''
|
|
|
|
stdout = ''
|
|
|
|
while p.poll() is None:
|
|
|
|
while p.poll() is None:
|
|
|
|
rfd, wfd, efd = select.select([p.stdout], [], [p.stdout], 1)
|
|
|
|
rfd, wfd, efd = select.select([p.stdout], [], [p.stdout], 1)
|
|
|
|
if p.stdout in rfd:
|
|
|
|
if p.stdout in rfd:
|
|
|
|
stdout += os.read(p.stdout.fileno(), 1024)
|
|
|
|
stdout += os.read(p.stdout.fileno(), 1024)
|
|
|
|
# older versions of ssh generate this error which we ignore
|
|
|
|
p.stdin.close() # close stdin after we read from stdout (see also issue #848)
|
|
|
|
stdout=stdout.replace("tcgetattr: Invalid argument\n", "")
|
|
|
|
|
|
|
|
# suppress Ubuntu 10.04/12.04 error on -tt option
|
|
|
|
|
|
|
|
stdout=stdout.replace("tcgetattr: Inappropriate ioctl for device\n","")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if p.returncode != 0 and stdout.find('Bad configuration option: ControlPersist') != -1:
|
|
|
|
if p.returncode != 0 and stdout.find('Bad configuration option: ControlPersist') != -1:
|
|
|
|
raise errors.AnsibleError('using -c ssh on certain older ssh versions may not support ControlPersist, set ANSIBLE_SSH_ARGS="" before running again')
|
|
|
|
raise errors.AnsibleError('using -c ssh on certain older ssh versions may not support ControlPersist, set ANSIBLE_SSH_ARGS="" before running again')
|
|
|
|