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
b94e2a1f
Commit
b94e2a1f
authored
May 13, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing bugs related to parsing and fixing up parsing integration tests (v2)
parent
b85ce388
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
20 deletions
+30
-20
lib/ansible/parsing/mod_args.py
+14
-4
lib/ansible/plugins/strategies/__init__.py
+1
-1
test/integration/Makefile
+5
-5
test/integration/roles/test_good_parsing/tasks/main.yml
+10
-10
No files found.
lib/ansible/parsing/mod_args.py
View file @
b94e2a1f
...
...
@@ -264,13 +264,23 @@ class ModuleArgsParser:
thing
=
value
action
,
args
=
self
.
_normalize_parameters
(
value
,
action
=
action
,
additional_args
=
additional_args
)
# FIXME: this should probably be somewhere else
RAW_PARAM_MODULES
=
(
'command'
,
'shell'
,
'script'
,
'include'
,
'include_vars'
,
'add_host'
,
'group_by'
,
'set_fact'
,
'meta'
,
)
# if we didn't see any module in the task at all, it's not a task really
if
action
is
None
:
raise
AnsibleParserError
(
"no action detected in task"
,
obj
=
self
.
_task_ds
)
# FIXME: disabled for now, as there are other places besides the shell/script modules where
# having variables as the sole param for the module is valid (include_vars, add_host, and group_by?)
#elif args.get('_raw_params', '') != '' and action not in ('command', 'shell', 'script', 'include_vars'):
# raise AnsibleParserError("this task has extra params, which is only allowed in the command, shell or script module.", obj=self._task_ds)
elif
args
.
get
(
'_raw_params'
,
''
)
!=
''
and
action
not
in
RAW_PARAM_MODULES
:
raise
AnsibleParserError
(
"this task '
%
s' has extra params, which is only allowed in the following modules:
%
s"
%
(
action
,
", "
.
join
(
RAW_PARAM_MODULES
)),
obj
=
self
.
_task_ds
)
# shell modules require special handling
(
action
,
args
)
=
self
.
_handle_shell_weirdness
(
action
,
args
)
...
...
lib/ansible/plugins/strategies/__init__.py
View file @
b94e2a1f
...
...
@@ -335,7 +335,7 @@ class StrategyBase:
# set the vars for this task from those specified as params to the include
for
b
in
block_list
:
b
.
_
vars
=
included_file
.
_args
.
copy
()
b
.
vars
=
included_file
.
_args
.
copy
()
return
block_list
...
...
test/integration/Makefile
View file @
b94e2a1f
...
...
@@ -24,11 +24,11 @@ CONSUL_RUNNING := $(shell python consul_running.py)
all
:
parsing test_var_precedence unicode test_templating_settings non_destructive destructive includes check_mode test_hash test_handlers test_group_by test_vault test_tags
parsing
:
ansible-playbook bad_parsing.yml
-i
$(INVENTORY)
-e
@
$(VARS_FILE)
$(CREDENTIALS_ARG)
-vvv
$(TEST_FLAGS)
--tags
prepare,common,scenario1
;
[
$$
?
-eq
3
]
ansible-playbook bad_parsing.yml
-i
$(INVENTORY)
-e
@
$(VARS_FILE)
$(CREDENTIALS_ARG)
-vvv
$(TEST_FLAGS)
--tags
prepare,common,scenario2
;
[
$$
?
-eq
3
]
ansible-playbook bad_parsing.yml
-i
$(INVENTORY)
-e
@
$(VARS_FILE)
$(CREDENTIALS_ARG)
-vvv
$(TEST_FLAGS)
--tags
prepare,common,scenario3
;
[
$$
?
-eq
3
]
ansible-playbook bad_parsing.yml
-i
$(INVENTORY)
-e
@
$(VARS_FILE)
$(CREDENTIALS_ARG)
-vvv
$(TEST_FLAGS)
--tags
prepare,common,scenario4
;
[
$$
?
-eq
3
]
ansible-playbook bad_parsing.yml
-i
$(INVENTORY)
-e
@
$(VARS_FILE)
$(CREDENTIALS_ARG)
-vvv
$(TEST_FLAGS)
--tags
prepare,common,scenario5
;
[
$$
?
-eq
3
]
ansible-playbook bad_parsing.yml
-i
$(INVENTORY)
-e
@
$(VARS_FILE)
$(CREDENTIALS_ARG)
-vvv
$(TEST_FLAGS)
--tags
prepare,common,scenario1
;
[
$$
?
-eq
4
]
ansible-playbook bad_parsing.yml
-i
$(INVENTORY)
-e
@
$(VARS_FILE)
$(CREDENTIALS_ARG)
-vvv
$(TEST_FLAGS)
--tags
prepare,common,scenario2
;
[
$$
?
-eq
4
]
ansible-playbook bad_parsing.yml
-i
$(INVENTORY)
-e
@
$(VARS_FILE)
$(CREDENTIALS_ARG)
-vvv
$(TEST_FLAGS)
--tags
prepare,common,scenario3
;
[
$$
?
-eq
4
]
ansible-playbook bad_parsing.yml
-i
$(INVENTORY)
-e
@
$(VARS_FILE)
$(CREDENTIALS_ARG)
-vvv
$(TEST_FLAGS)
--tags
prepare,common,scenario4
;
[
$$
?
-eq
4
]
ansible-playbook bad_parsing.yml
-i
$(INVENTORY)
-e
@
$(VARS_FILE)
$(CREDENTIALS_ARG)
-vvv
$(TEST_FLAGS)
--tags
prepare,common,scenario5
;
[
$$
?
-eq
4
]
ansible-playbook good_parsing.yml
-i
$(INVENTORY)
-e
@
$(VARS_FILE)
$(CREDENTIALS_ARG)
-v
$(TEST_FLAGS)
includes
:
...
...
test/integration/roles/test_good_parsing/tasks/main.yml
View file @
b94e2a1f
...
...
@@ -152,17 +152,17 @@
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: 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"
#
- name: assert the task with variable module name ran
#
assert:
#
that:
#
- result.invocation.module_name == "debug"
#
- result.msg == "this should be debugged"
-
name
:
test conditional includes
include
:
test_include_conditional.yml
...
...
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