-
Notifications
You must be signed in to change notification settings - Fork 23.9k
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
Fix missing ansible.builtin FQCNs in hardcoded action names #71824
Conversation
/rebuild_failed |
/rebuild_failed |
2 similar comments
/rebuild_failed |
/rebuild_failed |
lib/ansible/cli/adhoc.py
Outdated
@@ -69,7 +69,8 @@ def _play_ds(self, pattern, async_val, poll): | |||
mytask = {'action': {'module': context.CLIARGS['module_name'], 'args': parse_kv(context.CLIARGS['module_args'], check_raw=check_raw)}} | |||
|
|||
# avoid adding to tasks that don't support it, unless set, then give user an error | |||
if context.CLIARGS['module_name'] not in ('include_role', 'include_tasks') and any(frozenset((async_val, poll))): | |||
include_actions = ('include_role', 'include_tasks', 'ansible.builtin.include_role', 'ansible.builtin.include_tasks') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would just create a function that appends `ansible.builtin.' prefixed options to provided list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I already added such a function ;) I'm now using it everywhere. For efficiency, how about converting all the (now) dynamic function calls to new constants in (f.ex.) constants.py?
Does this also check the following? (#71878)
I do not find it, but this does not mean it is not there. |
@SimonHeimberg I just checked, with this PR your example also works (and with |
lib/ansible/constants.py
Outdated
@@ -59,6 +59,15 @@ def __getitem__(self, y): | |||
return self._value[y] | |||
|
|||
|
|||
def _add_builtin_fqcn(names): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function is fine, but this might not be best location, as constants.py has a heavy cost on import for those that already dont use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I first thought about lib/ansible/utils/collection_loader/init.py, but that comes with its own import tree. How about lib/ansible/utils/fqcn.py (a new file)? Or lib/ansible/utils/helpers.py?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
either works for me, you can even cache responses with a module level var
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a couple of small caveats, otherwise the code looks good.
@bcoca what about:
|
ci_complete
@bcoca I did the renaming. I had to adjust the renaming scheme a bit, since I noticed I used the same name twice. I hope the new one is fine as well :) (The tests that currently fail also fail in other PRs, so they should be unrelated.) |
/rebuild_failed |
/rebuild |
@bcoca thanks a lot for reviewing! |
SUMMARY
Fixes #71817, fixes #71818, fixes #72319, and a bunch of related problems. This is important since the docs try to always use the FQCN version of a action/module.
This is not the best way to fix this, since a collection might redirect an action to
ansible.builtin.xxx
; when invoked that way, the problems still happen. That is probably esoteric enough that it can be ignored (at least for now) :)ISSUE TYPE
COMPONENT NAME
core