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
93a55e8d
Commit
93a55e8d
authored
Jan 04, 2014
by
smoothify
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't override sudo if transport is set to local.
https://github.com/ansible/ansible/pull/5251
parent
c039e276
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
lib/ansible/runner/action_plugins/synchronize.py
+15
-4
No files found.
lib/ansible/runner/action_plugins/synchronize.py
View file @
93a55e8d
...
@@ -43,11 +43,18 @@ class ActionModule(object):
...
@@ -43,11 +43,18 @@ class ActionModule(object):
def
setup
(
self
,
module_name
,
inject
):
def
setup
(
self
,
module_name
,
inject
):
''' Always default to localhost as delegate if None defined '''
''' Always default to localhost as delegate if None defined '''
# Store original transport and sudo values.
self
.
original_transport
=
inject
.
get
(
'ansible_connection'
,
self
.
runner
.
transport
)
self
.
original_sudo
=
self
.
runner
.
sudo
self
.
transport_overridden
=
False
if
inject
.
get
(
'delegate_to'
)
is
None
:
if
inject
.
get
(
'delegate_to'
)
is
None
:
inject
[
'delegate_to'
]
=
'127.0.0.1'
inject
[
'delegate_to'
]
=
'127.0.0.1'
inject
[
'ansible_connection'
]
=
'local'
# IF original transport is not local, override transport and disable sudo.
# If sudo is active, disable from the connection set self.sudo to True.
if
self
.
original_transport
!=
'local'
:
if
self
.
runner
.
sudo
:
inject
[
'ansible_connection'
]
=
'local'
self
.
transport_overridden
=
True
self
.
runner
.
sudo
=
False
self
.
runner
.
sudo
=
False
def
run
(
self
,
conn
,
tmp
,
module_name
,
module_args
,
def
run
(
self
,
conn
,
tmp
,
module_name
,
module_args
,
...
@@ -78,6 +85,7 @@ class ActionModule(object):
...
@@ -78,6 +85,7 @@ class ActionModule(object):
dest_host
=
inject
.
get
(
'ansible_ssh_host'
,
inject
[
'inventory_hostname'
])
dest_host
=
inject
.
get
(
'ansible_ssh_host'
,
inject
[
'inventory_hostname'
])
# allow ansible_ssh_host to be templated
# allow ansible_ssh_host to be templated
dest_host
=
template
.
template
(
self
.
runner
.
basedir
,
dest_host
,
inject
,
fail_on_undefined
=
True
)
dest_host
=
template
.
template
(
self
.
runner
.
basedir
,
dest_host
,
inject
,
fail_on_undefined
=
True
)
dest_is_local
=
dest_host
in
[
'127.0.0.1'
,
'localhost'
]
dest_port
=
options
.
get
(
'dest_port'
)
dest_port
=
options
.
get
(
'dest_port'
)
inv_port
=
inject
.
get
(
'ansible_ssh_port'
,
inject
[
'inventory_hostname'
])
inv_port
=
inject
.
get
(
'ansible_ssh_port'
,
inject
[
'inventory_hostname'
])
...
@@ -114,8 +122,11 @@ class ActionModule(object):
...
@@ -114,8 +122,11 @@ class ActionModule(object):
if
'mode'
in
options
:
if
'mode'
in
options
:
del
options
[
'mode'
]
del
options
[
'mode'
]
# Allow custom rsync path argument.
rsync_path
=
options
.
get
(
'rsync_path'
,
None
)
rsync_path
=
options
.
get
(
'rsync_path'
,
None
)
if
not
rsync_path
and
self
.
runner
.
sudo
:
# If no rsync_path is set, sudo was originally set, and dest is remote then add 'sudo rsync' argument.
if
not
rsync_path
and
self
.
transport_overridden
and
self
.
original_sudo
and
not
dest_is_local
:
rsync_path
=
'sudo rsync'
rsync_path
=
'sudo rsync'
# make sure rsync path is quoted.
# make sure rsync path is quoted.
...
...
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