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
ddef608c
Commit
ddef608c
authored
Nov 22, 2012
by
Daniel Hokka Zakrisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wrap all remote commands in sh
parent
8e515c0c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
lib/ansible/runner/connection_plugins/paramiko_ssh.py
+3
-2
lib/ansible/runner/connection_plugins/ssh.py
+3
-4
No files found.
lib/ansible/runner/connection_plugins/paramiko_ssh.py
View file @
ddef608c
...
...
@@ -125,10 +125,11 @@ class Connection(object):
prompt
=
'[sudo via ansible, key=
%
s] password: '
%
randbits
sudocmd
=
'sudo -k && sudo -p "
%
s" -u
%
s /bin/sh -c
%
s'
%
(
prompt
,
sudo_user
,
pipes
.
quote
(
cmd
))
vvv
(
"EXEC
%
s"
%
sudocmd
,
host
=
self
.
host
)
shcmd
=
'/bin/sh -c '
+
pipes
.
quote
(
sudocmd
)
vvv
(
"EXEC
%
s"
%
shcmd
,
host
=
self
.
host
)
sudo_output
=
''
try
:
chan
.
exec_command
(
s
udo
cmd
)
chan
.
exec_command
(
s
h
cmd
)
if
self
.
runner
.
sudo_pass
:
while
not
sudo_output
.
endswith
(
prompt
):
chunk
=
chan
.
recv
(
bufsize
)
...
...
lib/ansible/runner/connection_plugins/ssh.py
View file @
ddef608c
...
...
@@ -93,10 +93,8 @@ class Connection(object):
prompt
=
'[sudo via ansible, key=
%
s] password: '
%
randbits
sudocmd
=
'sudo -k && sudo -p "
%
s" -u
%
s /bin/sh -c
%
s'
%
(
prompt
,
sudo_user
,
pipes
.
quote
(
cmd
))
sudo_output
=
''
ssh_cmd
.
append
(
sudocmd
)
else
:
ssh_cmd
.
append
(
cmd
)
cmd
=
sudocmd
ssh_cmd
.
append
(
'/bin/sh -c '
+
pipes
.
quote
(
cmd
))
vvv
(
"EXEC
%
s"
%
ssh_cmd
,
host
=
self
.
host
)
p
=
subprocess
.
Popen
(
ssh_cmd
,
stdin
=
subprocess
.
PIPE
,
...
...
@@ -107,6 +105,7 @@ class Connection(object):
if
self
.
runner
.
sudo
and
sudoable
and
self
.
runner
.
sudo_pass
:
fcntl
.
fcntl
(
p
.
stdout
,
fcntl
.
F_SETFL
,
fcntl
.
fcntl
(
p
.
stdout
,
fcntl
.
F_GETFL
)
|
os
.
O_NONBLOCK
)
sudo_output
=
''
while
not
sudo_output
.
endswith
(
prompt
):
rfd
,
wfd
,
efd
=
select
.
select
([
p
.
stdout
],
[],
[
p
.
stdout
],
self
.
runner
.
timeout
)
...
...
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