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
80df2135
Commit
80df2135
authored
Jul 30, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix parsing of tasks with variable module names
Also adding an integration test for same.
parent
189824dd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
2 deletions
+16
-2
lib/ansible/playbook/task.py
+3
-2
test/integration/roles/test_good_parsing/tasks/main.yml
+11
-0
test/integration/roles/test_good_parsing/vars/main.yml
+2
-0
No files found.
lib/ansible/playbook/task.py
View file @
80df2135
...
...
@@ -17,6 +17,7 @@
from
ansible
import
errors
from
ansible
import
utils
from
ansible.module_utils.splitter
import
split_args
import
os
import
ansible.utils.template
as
template
import
sys
...
...
@@ -234,13 +235,13 @@ class Task(object):
self
.
notify
=
[
self
.
notify
]
# split the action line into a module name + arguments
tokens
=
s
elf
.
action
.
split
(
None
,
1
)
tokens
=
s
plit_args
(
self
.
action
)
if
len
(
tokens
)
<
1
:
raise
errors
.
AnsibleError
(
"invalid/missing action in task. name:
%
s"
%
self
.
name
)
self
.
module_name
=
tokens
[
0
]
self
.
module_args
=
''
if
len
(
tokens
)
>
1
:
self
.
module_args
=
tokens
[
1
]
self
.
module_args
=
" "
.
join
(
tokens
[
1
:])
import_tags
=
self
.
module_vars
.
get
(
'tags'
,[])
if
type
(
import_tags
)
in
[
int
,
float
]:
...
...
test/integration/roles/test_good_parsing/tasks/main.yml
View file @
80df2135
...
...
@@ -152,4 +152,15 @@
that
:
-
complex_param == "this is a param in a complex arg with double quotes"
-
name
:
test variable module name
action
:
"
{{
variable_module_name
}}
msg='this
should
be
debugged'"
register
:
result
-
debug
:
var=result
-
name
:
assert the task with variable module name ran
assert
:
that
:
-
result.invocation.module_name == "debug"
-
result.msg == "this should be debugged"
test/integration/roles/test_good_parsing/vars/main.yml
0 → 100644
View file @
80df2135
---
variable_module_name
:
debug
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