Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

A few rules don't like empty meta files #2579

Closed
srittau opened this issue Oct 10, 2022 · 0 comments · Fixed by #2580
Closed

A few rules don't like empty meta files #2579

srittau opened this issue Oct 10, 2022 · 0 comments · Fixed by #2580
Labels
bug new Triage required

Comments

@srittau
Copy link

srittau commented Oct 10, 2022

Summary

A few rules don't like empty meta files. Consider a file 'roles/watchdog/meta/main.yml` with just the following content:

---

Running ansible-lint will produce the following warnings:

WARNING  Ignored exception from MetaChangeFromDefaultRule.<bound method MetaChangeFromDefaultRule.matchyaml of meta-incorrect: meta/main.yml default values should be changed.> while processing roles/watchdog/meta/main.yml (meta): 'NoneType' object has no attribute 'get'
WARNING  Ignored exception from MetaTagValidRule.<bound method MetaTagValidRule.matchyaml of meta-no-tags: Tags must contain lowercase letters and digits only.> while processing roles/watchdog/meta/main.yml (meta): 'NoneType' object has no attribute 'get'
WARNING  Ignored exception from MetaVideoLinksRule.<bound method MetaVideoLinksRule.matchyaml of meta-video-links: meta/main.yml video_links should be formatted correctly.> while processing roles/watchdog/meta/main.yml (meta): 'NoneType' object has no attribute 'get'

While this is easily worked around by deleting the meta file, the warning is not easy to understand and - I believe - unintended.

Issue Type
  • Bug Report
Ansible and Ansible Lint details
$ ansible --version
ansible [core 2.13.4]
  [...]
  python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
  jinja version = 3.0.2
  libyaml = True

$ ansible-lint --version
ansible-lint 6.8.0 using ansible 2.13.4
  • ansible installation method: pip
  • ansible-lint installation method: pip
OS / ENVIRONMENT

n/a

STEPS TO REPRODUCE
$ mkdir foo && cd foo
$ mkdir -p roles/watchdog/meta
$ cat >roles/watchdog/meta/main.yml <<EOD
---
EOD
$ ansible-lint 
Desired Behavior

No warnings. :)

Actual Behavior

See above.

@srittau srittau added bug new Triage required labels Oct 10, 2022
ssbarnea added a commit to ssbarnea/ansible-lint that referenced this issue Oct 10, 2022
ssbarnea added a commit that referenced this issue Oct 10, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug new Triage required
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant