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
4c84ba74
Commit
4c84ba74
authored
Jan 20, 2014
by
Paul Durivage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve su bug in paramiko libs
parent
24f11168
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
lib/ansible/runner/connection_plugins/paramiko_alt.py
+7
-4
lib/ansible/runner/connection_plugins/paramiko_ssh.py
+1
-1
No files found.
lib/ansible/runner/connection_plugins/paramiko_alt.py
View file @
4c84ba74
...
@@ -176,7 +176,7 @@ class Connection(object):
...
@@ -176,7 +176,7 @@ class Connection(object):
return
ssh
return
ssh
def
exec_command
(
self
,
cmd
,
tmp_path
,
sudo_user
,
sudoable
=
False
,
executable
=
'/bin/sh'
,
in_data
=
None
):
def
exec_command
(
self
,
cmd
,
tmp_path
,
sudo_user
=
None
,
sudoable
=
False
,
executable
=
'/bin/sh'
,
in_data
=
None
,
su
=
None
,
su_user
=
None
):
''' run a command on the remote host '''
''' run a command on the remote host '''
bufsize
=
4096
bufsize
=
4096
...
@@ -188,7 +188,7 @@ class Connection(object):
...
@@ -188,7 +188,7 @@ class Connection(object):
msg
+=
":
%
s"
%
str
(
e
)
msg
+=
":
%
s"
%
str
(
e
)
raise
errors
.
AnsibleConnectionFailed
(
msg
)
raise
errors
.
AnsibleConnectionFailed
(
msg
)
if
not
self
.
runner
.
sudo
or
not
sudoable
or
in_data
:
if
not
(
self
.
runner
.
sudo
and
sudoable
)
and
not
(
self
.
runner
.
su
and
su
)
or
in_data
:
if
executable
:
if
executable
:
quoted_command
=
executable
+
' -c '
+
pipes
.
quote
(
cmd
)
quoted_command
=
executable
+
' -c '
+
pipes
.
quote
(
cmd
)
else
:
else
:
...
@@ -208,7 +208,7 @@ class Connection(object):
...
@@ -208,7 +208,7 @@ class Connection(object):
sudo_output
=
''
sudo_output
=
''
try
:
try
:
chan
.
exec_command
(
shcmd
)
chan
.
exec_command
(
shcmd
)
if
self
.
runner
.
sudo_pass
:
if
self
.
runner
.
sudo_pass
or
self
.
runner
.
su_pass
:
while
not
sudo_output
.
endswith
(
prompt
)
and
success_key
not
in
sudo_output
:
while
not
sudo_output
.
endswith
(
prompt
)
and
success_key
not
in
sudo_output
:
chunk
=
chan
.
recv
(
bufsize
)
chunk
=
chan
.
recv
(
bufsize
)
if
not
chunk
:
if
not
chunk
:
...
@@ -220,7 +220,10 @@ class Connection(object):
...
@@ -220,7 +220,10 @@ class Connection(object):
'closed waiting for password prompt'
)
'closed waiting for password prompt'
)
sudo_output
+=
chunk
sudo_output
+=
chunk
if
success_key
not
in
sudo_output
:
if
success_key
not
in
sudo_output
:
chan
.
sendall
(
self
.
runner
.
sudo_pass
+
'
\n
'
)
if
sudoable
:
chan
.
sendall
(
self
.
runner
.
sudo_pass
+
'
\n
'
)
elif
su
:
chan
.
sendall
(
self
.
runner
.
su_pass
+
'
\n
'
)
except
socket
.
timeout
:
except
socket
.
timeout
:
raise
errors
.
AnsibleError
(
'ssh timed out waiting for sudo.
\n
'
+
sudo_output
)
raise
errors
.
AnsibleError
(
'ssh timed out waiting for sudo.
\n
'
+
sudo_output
)
...
...
lib/ansible/runner/connection_plugins/paramiko_ssh.py
View file @
4c84ba74
...
@@ -191,7 +191,7 @@ class Connection(object):
...
@@ -191,7 +191,7 @@ class Connection(object):
msg
+=
":
%
s"
%
str
(
e
)
msg
+=
":
%
s"
%
str
(
e
)
raise
errors
.
AnsibleConnectionFailed
(
msg
)
raise
errors
.
AnsibleConnectionFailed
(
msg
)
if
not
self
.
runner
.
sudo
or
not
sudoable
:
if
not
(
self
.
runner
.
sudo
and
sudoable
)
and
not
(
self
.
runner
.
su
and
su
)
:
if
executable
:
if
executable
:
quoted_command
=
executable
+
' -c '
+
pipes
.
quote
(
cmd
)
quoted_command
=
executable
+
' -c '
+
pipes
.
quote
(
cmd
)
else
:
else
:
...
...
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