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

meta/argument_specs.yml in a role is treated as a playbook #1688

Closed
briantist opened this issue Aug 6, 2021 · 3 comments · Fixed by #2091
Closed

meta/argument_specs.yml in a role is treated as a playbook #1688

briantist opened this issue Aug 6, 2021 · 3 comments · Fixed by #2091
Assignees
Labels
bug feature reproducer: present This PR or issue contains code, which reproduce the problem described or clearly understandable STR

Comments

@briantist
Copy link

briantist commented Aug 6, 2021

Summary

I'm hitting this issue by way of a vscode extension so I'm having a bit of a hard time determining if it's definitely an issue in ansible-lint or not (see tomaciazek/vscode-ansible#19).

I'm also hitting #1507 so it's difficult for me to run ansible-lint directly with a modern version of Ansible.

But the issue I'm seeing is that the meta/argument_specs.yml is "failing" with an unexpected internal error while other files in the role are being treated ok. This text is shown the extension's log:

[Info - 9:04:01 PM] [ansible-lint] WARNING Overriding detected file kind 'yaml' with 'playbook' for given positional argument: /home/briantist/code/flatiron-ansible-collections/ansible_collections/flatiron/vault/roles/agent/meta/argument_specs.yml
You can skip specific rules or tags by adding them to your configuration file:
# .ansible-lint
warn_list: # or 'skip_list' to silence them completely
- internal-error # Unexpected internal error

Finished with 1 failure(s), 0 warning(s) on 1 files.

I was able to workaround it by adding the following in .ansible-lint:

kinds:
  - meta: '**/roles/**/meta/argument_specs.yml'

I'm unsure if marking it as meta is "correct" but it does make the failure go away.

Issue Type
  • Bug Report
Ansible and Ansible Lint details
$ ansible --version
ansible [core 2.11.2] 
  config file = None
  configured module search path = ['/home/briantist/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/briantist/.a211/lib/python3.6/site-packages/ansible
  ansible collection location = /home/briantist/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/briantist/.a211/bin/ansible
  python version = 3.6.9 (default, Jan 26 2021, 15:33:00) [GCC 8.4.0]
  jinja version = 3.0.1
  libyaml = True

$ ansible-lint --version
ansible-lint 5.0.12 using ansible 2.11.2
FATAL: Ansible CLI (2.11.2) and python module (2.9.22) versions do not match. This indicates a broken execution environment.
  • ansible installation method: pip
  • ansible-lint installation method: pip
OS / ENVIRONMENT

Ubuntu 18.04 (WSL2)

STEPS TO REPRODUCE
Desired Behaviour

File is linted correctly.

Actual Behaviour

(in description)

@briantist briantist added bug new Triage required labels Aug 6, 2021
@ssbarnea
Copy link
Member

ssbarnea commented Aug 6, 2021

marking it as meta is wrong, it is a new format the linter does not support yet, just force mapping to "args_spec" there. The string has not yet special meaning but will help us write rules specific for these files. yaml checking will still be performed anyway.

@briantist
Copy link
Author

ok makes sense, should I change this to a feature request? Or open a new feature request?

@ssbarnea
Copy link
Member

ssbarnea commented Aug 6, 2021

Just make a PR to fix that bug and we are good. I think it would be a very good idea to include a sample such file inside examples/ directory (inside one role). I am almost sure that if you add it, at least one test will fail. When you make the fix, the test should start to work again. Than ensures that we do not have a regression in the future.

@ganeshrn ganeshrn added reproducer: present This PR or issue contains code, which reproduce the problem described or clearly understandable STR feature and removed new Triage required labels Sep 6, 2021
ziegenberg added a commit to ziegenberg/ansible-lint that referenced this issue May 1, 2022
…based on argument specification

Beginning with ansible version 2.11 role argument validation based on an
argument specification was introduced. This specification is defined in
the meta/argument_specs.yml file of a role.

This change enables the linter to detect this new format and for it to
be used in future rules.

Fixes: ansible#1688

Signed-off-by: Daniel Ziegenberg <[email protected]>
ziegenberg added a commit to ziegenberg/ansible-lint that referenced this issue May 1, 2022
…based on argument specification

Beginning with ansible version 2.11 role argument validation based on an
argument specification was introduced. This specification is defined in
the meta/argument_specs.yml file of a role.

This change enables the linter to detect this new format and for it to
be used in future rules.

Fixes: ansible#1688
Relates: ansible#1966

Signed-off-by: Daniel Ziegenberg <[email protected]>
ziegenberg added a commit to ziegenberg/ansible-lint that referenced this issue May 1, 2022
…based on argument specification

Beginning with ansible version 2.11 role argument validation based on an
argument specification was introduced. This specification is defined in
the meta/argument_specs.yml file of a role.

This change enables the linter to detect this new format and for it to
be used in future rules.

Fixes: ansible#1688
Relates: ansible#1966

Signed-off-by: Daniel Ziegenberg <[email protected]>
ssbarnea pushed a commit that referenced this issue May 3, 2022
Beginning with ansible version 2.11 role argument validation based on an
argument specification was introduced. This specification is defined in
the meta/argument_specs.yml file of a role.

This change enables the linter to detect this new format and for it to
be used in future rules.

Fixes: #1688
Relates: #1966

Signed-off-by: Daniel Ziegenberg <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug feature reproducer: present This PR or issue contains code, which reproduce the problem described or clearly understandable STR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants