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
7b6d64d9
Commit
7b6d64d9
authored
Oct 18, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4591 from bcoca/scriptnonrootsudosafe
now correctly changes script permission in all cases
parents
3c4dd618
c476ed93
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
lib/ansible/runner/action_plugins/script.py
+7
-4
No files found.
lib/ansible/runner/action_plugins/script.py
View file @
7b6d64d9
...
@@ -58,15 +58,18 @@ class ActionModule(object):
...
@@ -58,15 +58,18 @@ class ActionModule(object):
conn
.
put_file
(
source
,
tmp_src
)
conn
.
put_file
(
source
,
tmp_src
)
# fix file permissions when the copy is done as a different user
sudoable
=
True
# set file permissions, more permisive when the copy is done as a different user
if
self
.
runner
.
sudo
and
self
.
runner
.
sudo_user
!=
'root'
:
if
self
.
runner
.
sudo
and
self
.
runner
.
sudo_user
!=
'root'
:
prepcmd
=
'chmod a+rx
%
s'
%
tmp_src
cmd_args_chmod
=
"chmod a+rx
%
s"
%
tmp_src
sudoable
=
False
else
:
else
:
prepcmd
=
'chmod +x
%
s'
%
tmp_src
cmd_args_chmod
=
"chmod +rx
%
s"
%
tmp_src
self
.
runner
.
_low_level_exec_command
(
conn
,
cmd_args_chmod
,
tmp
,
sudoable
=
sudoable
)
# add preparation steps to one ssh roundtrip executing the script
# add preparation steps to one ssh roundtrip executing the script
env_string
=
self
.
runner
.
_compute_environment_string
(
inject
)
env_string
=
self
.
runner
.
_compute_environment_string
(
inject
)
module_args
=
prepcmd
+
'; '
+
env_string
+
tmp_src
+
' '
+
args
module_args
=
env_string
+
tmp_src
+
' '
+
args
handler
=
utils
.
plugins
.
action_loader
.
get
(
'raw'
,
self
.
runner
)
handler
=
utils
.
plugins
.
action_loader
.
get
(
'raw'
,
self
.
runner
)
result
=
handler
.
run
(
conn
,
tmp
,
'raw'
,
module_args
,
inject
)
result
=
handler
.
run
(
conn
,
tmp
,
'raw'
,
module_args
,
inject
)
...
...
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