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[play]: now also correctly works with import_playbook blocks #2359

Merged
merged 2 commits into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/ansiblelint/rules/name.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ def matchplay(self, file: Lintable, data: odict[str, Any]) -> list[MatchError]:
"""Return matches found for a specific play (entry in playbook)."""
if file.kind != "playbook":
return []
if "name" not in data and not any(
key in data
for key in ["import_playbook", "ansible.builtin.import_playbook"]
):
if "name" not in data:
return [
self.create_matcherror(
message="All plays should be named.",
Expand Down
3 changes: 2 additions & 1 deletion test/test_skip_import_playbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
- name: Should be shell # noqa command-instead-of-shell no-changed-when
ansible.builtin.shell: echo lol

- import_playbook: imported_playbook.yml
- name: Should not be imported
import_playbook: imported_playbook.yml
"""


Expand Down