Skip to content

bad k=v and no check_raw is an error - #84844

Open
bcoca wants to merge 1 commit into
ansible:develfrom
bcoca:fix_extra_raw
Open

bcoca wants to merge 1 commit into
ansible:develfrom
bcoca:fix_extra_raw

Conversation

@bcoca

@bcoca bcoca commented Mar 17, 2025

Copy link
Copy Markdown
Member

fixes #84756

ISSUE TYPE
  • Bugfix Pull Request

@ansibot ansibot added bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. has_issue needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Mar 17, 2025
@ansible ansible deleted a comment from ansibot Mar 17, 2025
@ansible ansible deleted a comment from ansibot Mar 17, 2025
Comment thread lib/ansible/utils/vars.py Resolved
Comment thread lib/ansible/parsing/splitter.py Resolved
@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Mar 18, 2025
@webknjaz webknjaz added the ci_verified Changes made in this PR are causing tests to fail. label Mar 18, 2025
@bcoca
bcoca force-pushed the fix_extra_raw branch 2 times, most recently from ca68cab to ee61c4d Compare March 26, 2025 16:00
@ansibot ansibot removed the ci_verified Changes made in this PR are causing tests to fail. label Mar 26, 2025
@webknjaz webknjaz added the ci_verified Changes made in this PR are causing tests to fail. label Mar 26, 2025
@ansibot ansibot removed the ci_verified Changes made in this PR are causing tests to fail. label Mar 26, 2025
@webknjaz webknjaz added the ci_verified Changes made in this PR are causing tests to fail. label Mar 27, 2025
@ansibot ansibot removed the ci_verified Changes made in this PR are causing tests to fail. label Mar 27, 2025
@webknjaz webknjaz added the ci_verified Changes made in this PR are causing tests to fail. label Mar 28, 2025
@ansibot ansibot removed the ci_verified Changes made in this PR are causing tests to fail. label Apr 4, 2025
@ansible ansible deleted a comment from ansibot Apr 4, 2025
@bcoca
bcoca marked this pull request as ready for review April 4, 2025 20:20
@ansibot ansibot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Apr 4, 2025
@ansibot ansibot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Apr 7, 2025
@ansibot ansibot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Apr 8, 2025
@ansibot ansibot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Apr 9, 2025
@ansible ansible deleted a comment from ansibot Apr 9, 2025
Comment thread lib/ansible/parsing/mod_args.py Resolved
Comment thread lib/ansible/parsing/splitter.py Resolved
Comment thread lib/ansible/parsing/splitter.py Resolved
@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed stale_review Updates were made after the last review and the last review is more than 7 days old. labels Apr 10, 2025
Comment thread test/units/parsing/test_splitter.py Resolved
Comment thread test/units/parsing/test_splitter.py Resolved
@ansibot ansibot added the stale_review Updates were made after the last review and the last review is more than 7 days old. label Apr 10, 2025
Comment thread test/units/parsing/test_splitter.py Resolved
Comment thread lib/ansible/parsing/mod_args.py Outdated
tmp_args = args.pop('args')
if isinstance(tmp_args, string_types):
tmp_args = parse_kv(tmp_args)
tmp_args = parse_kv(tmp_args, check_raw=action in FREEFORM_ACTIONS)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What's this change for? I noticed it was in the original commit, along with changelog entries that appear to be related, but those changelog entries were removed in a later commit.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

that should now affect the new parameter, as _raw_params for a module that does not support them should be an error

Comment thread lib/ansible/parsing/splitter.py Resolved
Comment thread lib/ansible/parsing/splitter.py Resolved
Comment thread lib/ansible/plugins/lookup/sequence.py Resolved
Comment thread test/units/parsing/test_splitter.py Resolved
@ansibot ansibot added stale_review Updates were made after the last review and the last review is more than 7 days old. and removed stale_review Updates were made after the last review and the last review is more than 7 days old. labels Apr 10, 2025
Comment thread lib/ansible/plugins/lookup/sequence.py Outdated
try:
if not self.parse_simple_args(term):
self.parse_kv_args(parse_kv(term))
self.parse_kv_args(parse_kv(term, populate_raw_params=False))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you add an integration test to verify the error handling for this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

was already on it!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

it seems we would error out later on either way, this just fails faster and slightly changes the message.

@ansibot ansibot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Apr 10, 2025
@bcoca

bcoca commented Apr 14, 2025

Copy link
Copy Markdown
Member Author

rethinking this as 2 PRs:

  • one for backport, detect _raw_params in extra and throw exception
  • one going forward, new parse_kv where check_raw really means check_raw and optional exception parameter on 'fail_on_partial_parse', deprecate existing in favor of new

@bcoca bcoca closed this Apr 14, 2025
@bcoca bcoca reopened this Apr 14, 2025
Comment thread lib/ansible/utils/vars.py
if '_raw_params' in data:
display.warning(f"Ignoring unparsable data: {data['_raw_params']}")
del data['_raw_params']
if not data: # if only bad args, reset to none to fail below

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

i'm 50/50 on this being a warning vs hard error

@ansibot ansibot added the needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html label Apr 21, 2025
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Apr 28, 2025
This makes it an error if the full string is parsed as 'raw'
but a warning if it is only a partial remainder
@ansibot ansibot removed needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Nov 6, 2025
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Nov 21, 2025
@ansibot ansibot added the needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html label Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug This issue/PR relates to a bug. has_issue needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. stale_review Updates were made after the last review and the last review is more than 7 days old.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support (or don't support) freeform parameters with --extra-vars

4 participants