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

include_role: Strictly check string datatype for *_from #68958

Merged
merged 1 commit into from
Apr 17, 2020

Conversation

Akasurde
Copy link
Member

SUMMARY

Strictly check string datatype for 'tasks_from', 'vars_from',
'defaults_from', and 'handlers_from' in include_role

Fixes: #68515

Signed-off-by: Abhijeet Kasurde akasurde@redhat.com

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

changelogs/fragments/68515_include_role_vars_from.yml
lib/ansible/playbook/role_include.py
test/integration/targets/include_import/role/test_include_role.yml
test/integration/targets/include_import/role/test_include_role_vars_from.yml
test/integration/targets/include_import/runme.sh

@ansibot ansibot added affects_2.10 This issue/PR affects Ansible v2.10 bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. needs_triage Needs a first human triage before being processed. support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Apr 15, 2020
@Akasurde Akasurde requested a review from sivel April 15, 2020 10:51
@ansibot
Copy link
Contributor

ansibot commented Apr 15, 2020

The test ansible-test sanity --test changelog [explain] failed with 1 error:

changelogs/fragments/68515_include_role_vars_from.yml:0:0: (WARNING/2) Inline emphasis start-string without end-string.

click here for bot help

@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed core_review In order to be merged, this PR must follow the core review workflow. labels Apr 15, 2020
Strictly check string datatype for 'tasks_from', 'vars_from',
'defaults_from', and 'handlers_from' in include_role

Fixes: ansible#68515

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
args_value = ir.args.get(key)
if not isinstance(args_value, string_types):
raise AnsibleParserError('Expected a string for %s but got %s instead' % (key, type(args_value)))
ir._from_files[from_key] = basename(args_value)
Copy link
Member

Choose a reason for hiding this comment

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

I think this is acceptable for now, but for the future, I think we should see if we can make use of post validating to cover all arguments in a single standard way.

@ansibot ansibot added has_issue core_review In order to be merged, this PR must follow the core review workflow. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Apr 15, 2020
@Akasurde Akasurde merged commit 3591451 into ansible:devel Apr 17, 2020
@Akasurde Akasurde deleted the i68515 branch April 17, 2020 05:27
@mkrizek mkrizek removed the needs_triage Needs a first human triage before being processed. label Apr 17, 2020
bcoca pushed a commit to bcoca/ansible that referenced this pull request Apr 22, 2020
Strictly check string datatype for 'tasks_from', 'vars_from',
'defaults_from', and 'handlers_from' in include_role

Fixes: ansible#68515

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
bcoca pushed a commit to bcoca/ansible that referenced this pull request Apr 28, 2020
Strictly check string datatype for 'tasks_from', 'vars_from',
'defaults_from', and 'handlers_from' in include_role

Fixes: ansible#68515

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
@ansible ansible locked and limited conversation to collaborators May 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.10 This issue/PR affects Ansible v2.10 bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. has_issue support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ERROR! Unexpected Exception, this is probably a bug: 'AnsibleSequence' object has no attribute 'rfind'
4 participants