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
d8cd3d60
Commit
d8cd3d60
authored
Sep 14, 2013
by
Timothy Appnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Straightened out the logic for delegate handling in synchronize action module
parent
90867d0d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
lib/ansible/runner/action_plugins/synchronize.py
+9
-4
No files found.
lib/ansible/runner/action_plugins/synchronize.py
View file @
d8cd3d60
...
@@ -35,13 +35,12 @@ class ActionModule(object):
...
@@ -35,13 +35,12 @@ 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 '''
if
inject
.
get
(
'delegate_to'
)
is
None
:
if
inject
[
'delegate_to'
]
is
None
:
inject
[
'delegate_to'
]
=
'127.0.0.1'
inject
[
'delegate_to'
]
=
'127.0.0.1'
inject
[
'ansible_connection'
]
=
'local'
inject
[
'ansible_connection'
]
=
'local'
# If sudo is active, disable from the connection set self.sudo to True.
# If sudo is active, disable from the connection set self.sudo to True.
if
self
.
runner
.
sudo
:
if
self
.
runner
.
sudo
:
self
.
runner
.
sudo
=
False
self
.
runner
.
sudo
=
False
self
.
sudo
=
True
def
run
(
self
,
conn
,
tmp
,
module_name
,
module_args
,
def
run
(
self
,
conn
,
tmp
,
module_name
,
module_args
,
inject
,
complex_args
=
None
,
**
kwargs
):
inject
,
complex_args
=
None
,
**
kwargs
):
...
@@ -63,8 +62,14 @@ class ActionModule(object):
...
@@ -63,8 +62,14 @@ class ActionModule(object):
except
KeyError
:
except
KeyError
:
pass
pass
src_host
=
inject
[
'delegate_to'
]
# from the perspective of the rsync call the delegate is the localhost
src_host
=
'127.0.0.1'
dest_host
=
inject
.
get
(
'ansible_ssh_host'
,
inject
[
'inventory_hostname'
])
dest_host
=
inject
.
get
(
'ansible_ssh_host'
,
inject
[
'inventory_hostname'
])
# edge case: explicit delegate and dest_host are the same
if
dest_host
==
inject
[
'delegate_to'
]:
dest_host
=
'127.0.0.1'
if
options
.
get
(
'mode'
,
'push'
)
==
'pull'
:
if
options
.
get
(
'mode'
,
'push'
)
==
'pull'
:
(
dest_host
,
src_host
)
=
(
src_host
,
dest_host
)
(
dest_host
,
src_host
)
=
(
src_host
,
dest_host
)
if
not
dest_host
is
src_host
:
if
not
dest_host
is
src_host
:
...
@@ -82,7 +87,7 @@ class ActionModule(object):
...
@@ -82,7 +87,7 @@ class ActionModule(object):
del
options
[
'mode'
]
del
options
[
'mode'
]
rsync_path
=
options
.
get
(
'rsync_path'
,
None
)
rsync_path
=
options
.
get
(
'rsync_path'
,
None
)
if
not
rsync_path
and
self
.
sudo
:
if
not
rsync_path
and
self
.
runner
.
sudo
:
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