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
abf2e139
Commit
abf2e139
authored
Oct 09, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Track local_action internally to prevent it from being overridden"
This reverts commit
49ca0eb7
.
parent
101c8785
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
22 deletions
+6
-22
lib/ansible/parsing/mod_args.py
+2
-1
lib/ansible/playbook/task.py
+0
-17
test/units/parsing/test_mod_args.py
+4
-4
No files found.
lib/ansible/parsing/mod_args.py
View file @
abf2e139
...
...
@@ -254,7 +254,6 @@ class ModuleArgsParser:
action
,
args
=
self
.
_normalize_parameters
(
thing
,
additional_args
=
additional_args
)
# local_action
local_action
=
False
if
'local_action'
in
self
.
_task_ds
:
# local_action is similar but also implies a delegate_to
if
action
is
not
None
:
...
...
@@ -263,6 +262,8 @@ class ModuleArgsParser:
delegate_to
=
'localhost'
action
,
args
=
self
.
_normalize_parameters
(
thing
,
additional_args
=
additional_args
)
# module: <stuff> is the more new-style invocation
# walk the input dictionary to see we recognize a module name
for
(
item
,
value
)
in
iteritems
(
self
.
_task_ds
):
if
item
in
module_loader
or
item
==
'meta'
or
item
==
'include'
:
...
...
lib/ansible/playbook/task.py
View file @
abf2e139
...
...
@@ -95,10 +95,6 @@ class Task(Base, Conditional, Taggable, Become):
self
.
_role
=
role
self
.
_task_include
=
task_include
# special flag for local_action: tasks, to make sure their
# connection type of local isn't overridden incorrectly
self
.
_local_action
=
False
super
(
Task
,
self
)
.
__init__
()
def
get_path
(
self
):
...
...
@@ -140,16 +136,6 @@ class Task(Base, Conditional, Taggable, Become):
t
=
Task
(
block
=
block
,
role
=
role
,
task_include
=
task_include
)
return
t
.
load_data
(
data
,
variable_manager
=
variable_manager
,
loader
=
loader
)
def
load_data
(
self
,
ds
,
variable_manager
=
None
,
loader
=
None
):
'''
We override load_data for tasks so that we can pull special flags
out of the task args and set them internaly only so the user never
sees them.
'''
t
=
super
(
Task
,
self
)
.
load_data
(
ds
=
ds
,
variable_manager
=
variable_manager
,
loader
=
loader
)
t
.
_local_action
=
t
.
args
.
pop
(
'_local_action'
,
False
)
return
t
def
__repr__
(
self
):
''' returns a human readable representation of the task '''
return
"TASK:
%
s"
%
self
.
get_name
()
...
...
@@ -280,7 +266,6 @@ class Task(Base, Conditional, Taggable, Become):
def
copy
(
self
,
exclude_block
=
False
):
new_me
=
super
(
Task
,
self
)
.
copy
()
new_me
.
_local_action
=
self
.
_local_action
new_me
.
_block
=
None
if
self
.
_block
and
not
exclude_block
:
...
...
@@ -298,7 +283,6 @@ class Task(Base, Conditional, Taggable, Become):
def
serialize
(
self
):
data
=
super
(
Task
,
self
)
.
serialize
()
data
[
'_local_action'
]
=
self
.
_local_action
if
self
.
_block
:
data
[
'block'
]
=
self
.
_block
.
serialize
()
...
...
@@ -317,7 +301,6 @@ class Task(Base, Conditional, Taggable, Become):
#from ansible.playbook.task_include import TaskInclude
block_data
=
data
.
get
(
'block'
)
self
.
_local_action
=
data
.
get
(
'_local_action'
,
False
)
if
block_data
:
b
=
Block
()
...
...
test/units/parsing/test_mod_args.py
View file @
abf2e139
...
...
@@ -109,11 +109,11 @@ class TestModArgsDwim(unittest.TestCase):
def
test_local_action_string
(
self
):
m
=
ModuleArgsParser
(
dict
(
local_action
=
'copy src=a dest=b'
))
mod
,
args
,
connection
=
m
.
parse
()
self
.
_debug
(
mod
,
args
,
connection
)
mod
,
args
,
delegate_to
=
m
.
parse
()
self
.
_debug
(
mod
,
args
,
delegate_to
)
self
.
assertEqual
(
mod
,
'copy'
)
self
.
assertEqual
(
args
,
dict
(
src
=
'a'
,
dest
=
'b'
,
_local_action
=
True
))
self
.
assertIs
(
connection
,
'local
'
)
self
.
assertEqual
(
args
,
dict
(
src
=
'a'
,
dest
=
'b'
))
self
.
assertIs
(
delegate_to
,
'localhost
'
)
def
test_multiple_actions
(
self
):
m
=
ModuleArgsParser
(
dict
(
action
=
'shell echo hi'
,
local_action
=
'shell echo hi'
))
...
...
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