Commit graph

32 commits

Author SHA1 Message Date
Sam Doooran
8e022ef00a
import_playbook - change additional params to deprecation ()
* import_playbook - change additional params to deprecation

I incorrectly recommended this be set as a warning when it should have been a deprecation.

* Fix deprecation sanity test to not required a collection name when not inside a collection
2020-12-17 14:14:58 -05:00
Felix Fontein
da60525610
Fix missing ansible.builtin FQCNs in hardcoded action names ()
* Make sure hard-coded action names also check for FQCN.
* Use _add_internal_fqcn() to avoid hardcoded lists and typoes.
2020-11-03 08:51:31 -05:00
Matt Martz
e73a0b2460
Explicitly get the include task, and not assume it is the parent ()
* Explicitly get the include task, and not assume it is the parent. Fixes 
2020-10-29 15:15:18 -04:00
Matt Martz
7c60dadb9a
Updates to Integration tests to pass against Alpine ()
* Start of alpine testing

* More updates

* Add forgotten file

* remove debug

* Add alpine3

* equal

* group 4

* group 4

* group 5

* Try to decrease test length

* libuser only available in testing

* Remove debug

* Make loops target work on hosts without gnu date

* Enable alpine testing

* ci_complete

* Don't specify uid for creating test user

* ci_complete

* Re-sort docker completion

* use newer container image

* ci_complete

* fix indentation

Co-authored-by: Matt Clay <matt@mystile.com>

Co-authored-by: Matt Clay <matt@mystile.com>
2020-08-07 14:28:10 -05:00
Matt Martz
4e27569347
Add more include and yaml parsing tests ()
These additional tests should provide coverage for features currently tested by the postgres incidental tests.
2020-08-04 11:24:52 -07:00
Kshitij Chawla
32c392e622
Raise Warning when import_playbook receives additional parameters ()
* Extra whitespace around imported playbook filename are stripped.
* Corrected call for display.deprecated
* Changed warning type & added test
* Added auto verification of raised warning
* More accurate warning message
2020-06-10 13:22:40 -04:00
Abhijeet Kasurde
3591451bc7
include_role: Strictly check string datatype for *_from ()
Strictly check string datatype for 'tasks_from', 'vars_from',
'defaults_from', and 'handlers_from' in include_role

Fixes: 

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2020-04-17 10:57:41 +05:30
Vasili
9b28f1f5d9
Fix incorrect "Could not match supplied host pattern" warning () () 2020-02-14 15:50:52 -06:00
Kiyo Nagamine
daecbb9bf0 Ensure allow_duplicates: true enables to run single role multiple times () ()
* Ensure `allow_duplicates: true` enables to run single role multiple times()

* Changed return value in `_load_roles` . Fixes 

* Add changelog fragment

* Add an integration test for the issue

* Fix changelog generation error and integration test.

* Fix yaml syntax error in changelog fragment
2019-12-03 10:21:54 -05:00
Sam Doran
c485a1b91e
Fix sanity tests based on newer version of shellcheck ()
- change egrep to grep -E
- store exit codes and check them directly
- ignore SC1091
2019-08-12 16:24:28 -04:00
Martin Krizek
e8948f7655
Actually run valid_include_keywords test () 2019-06-11 18:21:28 +02:00
Will Thames
cd95843ea5 Make ansible adhoc work with include_role ()
* Make ansible adhoc work with include_role

Fix logic condition so that include_role works
without

```
ERROR! 'async_val' is not a valid attribute for a IncludeRole

The error appears to be in 'None': line 0, column 0, but may
be elsewhere in the file depending on the exact syntax problem.

(could not open file to display line)
```

* Add include_role test for adhoc
2019-05-08 09:53:24 -04:00
Matt Martz
fbf2d5d2f4
Don't pollute include_variables ()
* Don't pollute include_variables. Fixes . Fixes .

* Rename include_variables to include_args, so we can make the distinction about what they are

* Track args and vars separately

* oops

* oops again

* linting fix

* Add test
2019-04-09 10:14:42 -05:00
Matt Clay
8aa4b037ce Fix include_import test.
This will allow the test to work when HOST_PATTERN_MISMATCH is set to error.
2019-03-21 20:08:27 -07:00
Matt Clay
828e8d4957 Move include_import test inventory into test. 2019-01-09 19:09:33 -08:00
Matt Martz
3b49bbcfde Give IncludedFile more context via ansible_search_path ()
* Give IncludedFile more context via ansible_search_path to template lookups. Fixes 

* Update units
2019-01-03 16:13:02 -05:00
Matt Martz
77befcf5d7
Do not allow addressing an import from handlers via notify. Fixes () 2018-11-29 13:50:07 -06:00
Jimmy McCrory
d2969884b4 Add run_once as a valid TaskInclude keyword ()
* Add run_once as a valid TaskInclude keyword

* Add changelog fragment

* Add integration test that documents run_once behavior
2018-11-08 10:29:24 -05:00
Matt Martz
d5e4f37ca0
Ensure we don't overwrite roles from include/import_role when loading the play ()
* Ensure we don't overwrite roles from include/import_role when loading the play. Fixes 

* Add changelog fragment
2018-10-23 11:08:48 -05:00
Matt Martz
a06a5ded61
Do not use mutable defaults in FieldAttribute, instead allow supplying a callable for defaults of mutable types. Fixes () 2018-10-12 10:43:09 -05:00
Matt Martz
27b4d7ed31
Add feature to expose vars/defaults with include/import_role ()
* First pass at making 'private' work on include_role, imports are always public

* Prevent dupe task execution and overwriting handlers

* New functionality will use public instead of deprecated private

* Add tests for public exposure

* Validate vars before import/include to ensure they don't expose too early

* Add porting guide docs about public argument and change to import_role

* Add additional docs about public and vars exposure to module docs

* Insert role handlers at parse time, exposing them globally
2018-07-15 09:59:30 -05:00
Matt Martz
50905b980d Support item label in v2_playbook_on_include ()
* Support item label in v2_playbook_on_include. Fixes 

* test fixes
2018-07-09 11:27:00 -04:00
Matt Martz
76867730bf
Don't ignore a duplicate host for an already processed include ()
* Don't ignore a duplicate host for an already processed include, assume that the repetition indicates a new include. Fixes 

* Add intg tests to ensure duplicate items in loop are not deduped

* Add note about relative indexing
2018-06-08 15:36:22 -05:00
Matt Martz
c403f01971
Revert , improve error messaging ()
* Revert " Update TaskInclude _raw_params with the expanded/templated path to file ()"

This reverts commit 4b01b92cfe.

* Improve error messaging, catch error templating parent path
2018-06-07 09:00:50 -05:00
Matt Martz
da4ff18406
Support 'apply' to apply attributes to included tasks - Impl 1 ()
* Support 'apply' to apply attributes to included tasks

* Cannot validate args for task_include

* Only allow apply on include_

* Re-enable arg validation, but only for include_tasks and import_tasks

* s/task/ir/

* Add tests for include_ apply

* Include context with AnsibleParserError

* Add docs for apply

* version_added

* Add free-form documentation back

* Add example of free-form with apply
2018-05-31 12:08:38 -05:00
Sam Doran
f872b70449 Remove skipping of never tag since it is done automatically () 2018-05-03 14:56:42 +10:00
Matt Martz
4b01b92cfe
Update TaskInclude _raw_params with the expanded/templated path to file ()
* Update TaskInclude _raw_params with the expanded/templated path to file

* Add tests to validate host vars include paths
2018-04-26 14:25:02 -05:00
Matt Martz
2f5161628a
Don't skip conditional exception on includes ()
* task_executor.py: Raise 'conditional exception' in case of 'include_*'

Fixes 

Signed-off-by: Patrick Ringl <patrick_@freenet.de>

* Re-organize tests, add static include test with undefined var

* Remove unnecessary conditional
2018-04-26 13:39:44 -05:00
Matt Martz
354aa8d602
Skip self._parent on dynamic, defer to grandparent for attr lookup ()
* Skip self._parent on dynamic, defer to grandparent for attr lookup

* Revert _inheritable

* Add tests for include inheritance from static blocks

Fixes  
2018-04-16 16:46:47 -05:00
Sam Doran
e5776a129a Add include_import tests for many top level include_tasks ()
* Add include_import tests for many top level include_tasks

Rename a few test playbooks to make more sense

* Use fewer include_tasks due to memory limits in CI
2018-04-11 17:08:33 -04:00
kiorky
9001a8794f FIX: multiple nested tasks include levels ()
* Test for include_tasks & include_role bug

Related to ansible/ansible:#21890

* Fix nested include_tasks called from role

This fixes the path of included files when you want
to call include_task inside a role's task file and this
role is itself called from multiple level of playbook include_tasks

Related to ansible/ansible:#21890
This fixes ansible/ansible:#35109
2018-01-31 07:35:06 -06:00
Sam Doran
10a8c6bc25 Integration tests for import/include ()
* First pass at include_role tests

* Reorganize test structure

Do all import and include tests in a single target.

* Build out more tests and test with linear and free strategy for each type

* import_role tests

* Set target host for play test

* Basic import_playbook tests

* Basic import/include_tasks tests

* Add recursion test

* import_playbook tests

* Add import_playbook group_vars test

Issue 

* Additional group_var tests for import_playbook

* Enable recursion test

* More work on import_tasks

* Run all tests via run.sh, improve conditional tests, add never tag

Add never tag to certain failining tests and explicitly skip it for now until  is merged. Some tasks need to remain commented out because they cause the entire play to fail and aren't skippable by tags because they are syntax and/or variable checks.

Improve test for whether or not a role was run based on a conditional. Since the [import|include]_role does not register a variable, use a variable that is set inside a role as a canary test for whether or not the role was run.

* Use a fail task rather than trigger a failure via bogus command

This should resolve the "unstable" test results.

* Import tag tests

Fix bug it tests where validate tasks weren't run on tag tests.
Add tests for task import/include with tags.

* Remove test for playbook group_var inheritance
2018-01-19 08:23:48 -08:00