You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ansible-lint --versionansible-lint 6.22.2 using ansible-core:2.16.2 ansible-compat:4.1.11 ruamel-yaml:0.18.5 ruamel-yaml-clib:0.2.8
ansible installation method: pip
ansible-lint installation method: pip
STEPS TO REPRODUCE
Init new role. ansible-galaxy init test
Remove dependencies: [] from test/meta/main.yml.
Run ansible-lint test for the role.
Desired Behavior
The presence of the dependencies key should be checked.
If dependencies is a required key, then:
The Ansible Meta json schema should be updated.
There should be a linter error.
Actual Behavior
WARNING Ignored exception from RoleNames.<bound method RoleNames.matchyaml of role-name: Role name {0} does not match ``^*$`` pattern.> while processing test/meta/main.yml (meta): 'dependencies'
DEBUG Ignored exception details
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/ansiblelint/_internal/rules.py", line 93, in getmatches
matches.extend(method(file))
^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/ansiblelint/rules/role_name.py", line 98, in matchyaml
for role in file.data["dependencies"]:
~~~~~~~~~^^^^^^^^^^^^^^^^
KeyError: 'dependencies'
ansible-galaxy init test
sed -i 's/dependencies: \[\]//' test/meta/main.yml
ansible-lint -vvvvv test
Summary
If the
meta/main.yml
of a role does not have adependencies
key, then ansible-lint will throw an exception.This issue was introduced by #3923.
Issue Type
OS / ENVIRONMENT
STEPS TO REPRODUCE
ansible-galaxy init test
dependencies: []
fromtest/meta/main.yml
.ansible-lint test
for the role.Desired Behavior
The presence of the
dependencies
key should be checked.If
dependencies
is a required key, then:Actual Behavior
The text was updated successfully, but these errors were encountered: