Include parent actions (block, include_tasks, ...) in matchtask() #1502
Unanswered
maunzCache
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
"Parent actions" - in lack for a better name - such as
block, always, rescue, include, include_tasks, import_playbook and import_tasks
are removed from the list of tasks available inAnsibleLintRule.matchtasks()
andAnsibleLintRule.matchtask()
. This requires custom implementation to check generic parameters such as when, become, ignore_errors, vars, ...This happens due to removal in
ansiblelint.utils.get_action_tasks()
. The removal of those keywords seems to be intentional as the comment blocks suggests.Issue Type
Ansible and Ansible Lint details
OS / ENVIRONMENT
STEPS TO REPRODUCE
Consider the following lint rule:
Asserting on this implementation i get only 7 of 10 checks by checking the tasks from the
modules_prevents_unit_test
variable. The commentary shows which are missing.Assertion
Snipped from the test tasks
Desired Behaviour
I would like to be able to also check "parent actions" as described in the summary but without implementing additional or redundant got already present in
ansible.utils
. There is a set of customer linting rules in my environment which i'd like to apply to all kinds of tasks even though these are merely "wrapper" (such as block). Still i am aware that those keywords are removed from the output as loops may appear when collection the "child actions" from the "parent action".Actual Behaviour
The current implementation will remove the desired actions from the output. My test environment cannot rely on linting as there may be false-negatives when applying those rules.
There is a workaround for the situation but requires somewhat of an overhead. I would be able to implement the lookup myself when overriding matchtasks().
Beta Was this translation helpful? Give feedback.
All reactions