Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add _post_validate_tags to flatten extended tags that need templating #70329

Open
wants to merge 5 commits into
base: devel
Choose a base branch
from

Conversation

s-hertel
Copy link
Contributor

@s-hertel s-hertel commented Jun 26, 2020

SUMMARY

Fixes #69903

Since the tags FieldAttribute uses extend=True, we may get a list containing list variables. Post validation needs to flatten and deduplicate those after templating.

ISSUE TYPE
  • Bugfix Pull Request

add tests

ci_complete
@s-hertel s-hertel force-pushed the post-validate-extended-tags branch from 5936b01 to ead1b5f Compare Jun 26, 2020
@@ -42,12 +42,63 @@ def _load_tags(self, attr, ds):
else:
raise AnsibleError('tags must be specified as a list', obj=ds)

def _post_validate_tags(self, attr, value, templar):
'''Tags are templatable and use extend=True, so this value
Copy link
Member

@bcoca bcoca Jun 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not just tags, i would make this a generic function for templatable and appendable FieldAttirbutes (tags, environment, module_defaults and conditionals)

Copy link
Member

@bcoca bcoca Jun 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

though .. conditionals can get 'iffy' since when: [] is kindof valid

Copy link
Contributor Author

@s-hertel s-hertel Jun 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point

@s-hertel s-hertel changed the title Add _post_validate_tags to flatten extended tags that need templating [WIP] Add _post_validate_tags to flatten extended tags that need templating Jun 26, 2020
@ansibot ansibot added WIP affects_2.11 bug needs_triage support:community support:core labels Jun 26, 2020
@ansibot

This comment has been minimized.

@samdoran samdoran removed the needs_triage label Jun 30, 2020
lib/ansible/playbook/taggable.py Outdated Show resolved Hide resolved
@ansibot

This comment has been minimized.

@s-hertel s-hertel force-pushed the post-validate-extended-tags branch from 79a8e59 to deafe52 Compare Jul 2, 2020
@s-hertel s-hertel force-pushed the post-validate-extended-tags branch from deafe52 to abcfdc6 Compare Jul 2, 2020
@ansibot ansibot added the stale_ci label Jul 10, 2020
@s-hertel s-hertel force-pushed the post-validate-extended-tags branch from 993cd21 to 85a2d71 Compare Jul 15, 2020
@ansibot ansibot removed the stale_ci label Jul 15, 2020
@ansibot

This comment has been minimized.

@s-hertel s-hertel force-pushed the post-validate-extended-tags branch from 85a2d71 to 9ed9ef7 Compare Jul 15, 2020
s-hertel added 2 commits Jul 16, 2020
fix taggable mixin
@s-hertel s-hertel force-pushed the post-validate-extended-tags branch from 9ed9ef7 to 5083fc9 Compare Jul 16, 2020
@ansibot ansibot added the stale_ci label Jul 25, 2020
@ansibot ansibot added the needs_rebase label Aug 2, 2020
@ansibot ansibot removed the stale_ci label Dec 8, 2020
@ansibot ansibot added the pre_azp label Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects_2.11 bug needs_rebase pre_azp support:community support:core WIP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants