Open CAAHS opened 1 month ago
I had a quick look at this, and noticed the following: The error only occurs when the non-full-qualified task name setup
is used, it works fine when using the full-qualified ansible.builtin.setup
. In both cases the value of (pre #4216 used) resolved_fqcn
is ansible.builtin.setup
, but the value of (post #4216 used) plugin_resolved_name
differs: it's setup
in the non-fq case, and ansible_collections.ansible.builtin.plugins.modules.setup
in the fq case.
EDIT: A very hacky/bad solution that seems to work
--- a/src/ansiblelint/rules/args.py
+++ b/src/ansiblelint/rules/args.py
@@ -146,4 +146,4 @@ class ArgsRule(AnsibleLintRule):
spec = importlib.util.spec_from_file_location(
- name=loaded_module.plugin_resolved_name,
+ name=loaded_module.plugin_resolved_name if '.' in loaded_module.plugin_resolved_name else loaded_module.resolved_fqcn,
location=loaded_module.plugin_resolved_path,
)
Thanks for taking a look @corubba
We can confirm the observation that the module name (task name) is triggering it, and that using a fully qualified name is w/o the diagnostics.
This also already strengthened our first impression towards that this might be a regression when introducing plugin_resolved_name
.
We can further confirm that your provided patch is w/o the diagnostic message as well for the (not fully-qualified) name.
Putting your own judgement of the patch aside for a brief moment, what do you think about adding this reports reproducer as a test case that tests for the flaw in support/context so it is already captured? This could also help to prepare a better patch in a more controlled manner. Awaiting your thoughts. @corubba
To be perfectly honest, I don't know. Someone smarter than me needs to have a look at this.
Summary
Running ansible-lint(1) emits a diagnostic message:
Issue Type
OS / ENVIRONMENT
STEPS TO REPRODUCE
We use the ansible-lint version as documented and the following plays/fact-cache.yml (playbook):
Desired Behavior
The above documented diagnostics are not emitted.
Actual Behavior
The above documented diagnostics are emitted.
Excerpt from extra verbosity:
As we're getting a stack trace, also the output of the Ansible playbook syntax check command:
As we've searched your forge, a reference we best guessed for context: https://github.com/ansible/ansible-lint/pull/4216/files/1b424b5122b3158df808fcde4bdd40c40474dc49#diff-ade5ce2a08eeaf42cfeb0027865a0b7cd2c987da9af081d6604ce9d937d13bd0L146-L148