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
76037168
Commit
76037168
authored
Mar 05, 2014
by
James Tanner
Committed by
James Cammarata
Mar 10, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #6298 and adds a sudo unit test for synchronize
parent
118d24d1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
3 deletions
+36
-3
lib/ansible/runner/action_plugins/synchronize.py
+7
-2
test/units/TestSynchronize.py
+29
-1
No files found.
lib/ansible/runner/action_plugins/synchronize.py
View file @
76037168
...
@@ -173,6 +173,11 @@ class ActionModule(object):
...
@@ -173,6 +173,11 @@ class ActionModule(object):
if
self
.
runner
.
noop_on_check
(
inject
):
if
self
.
runner
.
noop_on_check
(
inject
):
module_items
+=
" CHECKMODE=True"
module_items
+=
" CHECKMODE=True"
return
self
.
runner
.
_execute_module
(
conn
,
tmp
,
'synchronize'
,
# run the module and store the result
module_items
,
inject
=
inject
)
result
=
self
.
runner
.
_execute_module
(
conn
,
tmp
,
'synchronize'
,
module_items
,
inject
=
inject
)
# reset the sudo property
self
.
runner
.
sudo
=
self
.
original_sudo
return
result
test/units/TestSynchronize.py
View file @
76037168
...
@@ -61,7 +61,35 @@ class TestSynchronize(unittest.TestCase):
...
@@ -61,7 +61,35 @@ class TestSynchronize(unittest.TestCase):
assert
runner
.
executed_inject
[
'delegate_to'
]
==
"127.0.0.1"
,
"was not delegated to 127.0.0.1"
assert
runner
.
executed_inject
[
'delegate_to'
]
==
"127.0.0.1"
,
"was not delegated to 127.0.0.1"
assert
runner
.
executed_args
==
"dest=root@el6.lab.net:/tmp/bar src=/tmp/foo"
,
"wrong args used"
assert
runner
.
executed_args
==
"dest=root@el6.lab.net:/tmp/bar src=/tmp/foo"
,
"wrong args used"
assert
runner
.
sudo
==
False
,
"sudo not set to false"
assert
runner
.
sudo
==
None
,
"sudo was not reset to None"
def
test_synchronize_action_sudo
(
self
):
""" verify the synchronize action plugin unsets and then sets sudo """
runner
=
FakeRunner
()
runner
.
sudo
=
True
runner
.
remote_user
=
"root"
runner
.
transport
=
"ssh"
conn
=
FakeConn
()
inject
=
{
'inventory_hostname'
:
"el6.lab.net"
,
'inventory_hostname_short'
:
"el6"
,
'ansible_connection'
:
None
,
'ansible_ssh_user'
:
'root'
,
'delegate_to'
:
None
,
'playbook_dir'
:
'.'
,
}
x
=
Synchronize
(
runner
)
x
.
setup
(
"synchronize"
,
inject
)
x
.
run
(
conn
,
"/tmp"
,
"synchronize"
,
"src=/tmp/foo dest=/tmp/bar"
,
inject
)
assert
runner
.
executed_inject
[
'delegate_to'
]
==
"127.0.0.1"
,
"was not delegated to 127.0.0.1"
assert
runner
.
executed_args
==
'dest=root@el6.lab.net:/tmp/bar src=/tmp/foo rsync_path="sudo rsync"'
,
\
"wrong args used:
%
s"
%
runner
.
executed_args
assert
runner
.
sudo
==
True
,
"sudo was not reset to True"
def
test_synchronize_action_local
(
self
):
def
test_synchronize_action_local
(
self
):
...
...
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