Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
b72af8d0
Commit
b72af8d0
authored
Jun 22, 2012
by
Dave Hatton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change to STDOUT from PIPE to get ssh connection module working
parent
6c37cbda
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
lib/ansible/runner/connection/ssh.py
+5
-3
No files found.
lib/ansible/runner/connection/ssh.py
View file @
b72af8d0
...
...
@@ -76,7 +76,7 @@ class SSHConnection(object):
sudo_output
=
''
ssh_cmd
.
append
(
sudocmd
)
p
=
subprocess
.
Popen
(
ssh_cmd
,
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
if
self
.
runner
.
sudo_pass
:
fcntl
.
fcntl
(
p
.
stdout
,
fcntl
.
F_SETFL
,
fcntl
.
fcntl
(
p
.
stdout
,
fcntl
.
F_GETFL
)
|
os
.
O_NONBLOCK
)
...
...
@@ -89,14 +89,14 @@ class SSHConnection(object):
raise
errors
.
AnsibleError
(
'ssh connection closed waiting for sudo password prompt'
)
sudo_output
+=
chunk
else
:
(
stdout
,
stderr
)
=
p
.
communicate
()
stdout
=
p
.
communicate
()
raise
errors
.
AnsibleError
(
'ssh connection error waiting for sudo password prompt'
)
p
.
stdin
.
write
(
self
.
runner
.
sudo_pass
+
'
\n
'
)
fcntl
.
fcntl
(
p
.
stdout
,
fcntl
.
F_SETFL
,
fcntl
.
fcntl
(
p
.
stdout
,
fcntl
.
F_GETFL
)
&
~
os
.
O_NONBLOCK
)
else
:
ssh_cmd
.
append
(
cmd
)
p
=
subprocess
.
Popen
(
ssh_cmd
,
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
# We can't use p.communicate here because the ControlMaster may have stdout open as well
p
.
stdin
.
close
()
...
...
@@ -105,6 +105,8 @@ class SSHConnection(object):
rfd
,
wfd
,
efd
=
select
.
select
([
p
.
stdout
],
[],
[
p
.
stdout
],
1
)
if
p
.
stdout
in
rfd
:
stdout
+=
os
.
read
(
p
.
stdout
.
fileno
(),
1024
)
# older versions of ssh generate this error which we ignore
stdout
=
stdout
.
replace
(
"tcgetattr: Invalid argument
\n
"
,
""
)
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'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment