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

name[casing] lint for notify directives should take into account <role name> : <Task name> syntax #4169

Closed
bsteinb opened this issue May 16, 2024 · 1 comment · Fixed by #4196
Assignees
Labels

Comments

@bsteinb
Copy link

bsteinb commented May 16, 2024

Summary

The notify: directive for running handlers supports a syntax <role name> : <Task name> to help avoid name collisions between handlers from different roles.

As role names are usually all lower case, the changes in #4149, which check the casing of the first letter in the argument to a notify: directive, cause failures when this <role name> : <Task name> syntax is used.

Issue Type
  • Bug Report
OS / ENVIRONMENT
ansible-lint --version
ansible-lint 24.5.0 using ansible-core:2.16.6 ansible-compat:24.5.1 ruamel-yaml:0.18.6 ruamel-yaml-clib:0.2.8
  • ansible installation method: pip
  • ansible-lint installation method: pip
STEPS TO REPRODUCE

Have a role role with a tasks/main.yml as follows:

- name: Task
  ansible.builtin.debug:
    msg: Task
  notify: 'role : Handler'

and a handlers/main.yml as follows:

- name: Handler
  ansible.builtin.debug:
    msg: Handler

Then run ansible-lint on role/tasks/main.yml.

Desired Behavior

No failures.

Actual Behavior

The argument of the notify: directive fails the name[casing] lint, even though it is legal syntax and the handler and role names individually follow conventions and pass ansible-lint's checks.

name[casing]: Task notify 'role : Handler' should start with an uppercase letter.
roles/role/tasks/main.yml:1 Task/Handler: Task
@bsteinb bsteinb added bug new Triage required labels May 16, 2024
@ClausHolbechArista
Copy link

ClausHolbechArista commented May 16, 2024

EDIT: My point is covered by #4168. Sorry for the noise :)

The new linting rule also impacts the use of topics using the listen keyword as described in the doc.
The example in the doc would fail the linting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants