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

Commits on Aug 30, 2022

  1. Fix "Raise name[play] for plays missing a name"

    When running ansible-lint on a playbook like:
    
    ```
    ---
    - ansible.builtin.import_playbook: "test.yml"
    ```
    
    ansible-lint is now "complaining":
    
    ```
    WARNING  Ignored exception from NameRule.<bound method AnsibleLintRule.matchyaml of name: Rule for checking task and play names.>: 'name'
    ```
    
    The test ``in src/ansiblelint/rules/name.py:matchplay()`` is trying to ignore
    the import_playbook case but with current test leads to the line:
    
    ```
    data["name"], lintable=file, linenumber=data[LINE_NUMBER_KEY]
    ```
    
    and in this example, the key "name" doesn't exist, leading to the warning.
    
    The proposed solution is to suppress the special casing.
    
    Signed-off-by: Arnaud Patard <apatard@hupstream.com>
    apatard committed Aug 30, 2022
    Configuration menu
    Copy the full SHA
    220e039 View commit details
    Browse the repository at this point in the history
  2. test/test_skip_import_playbook.py: Add name to import_playbook play

    Now that ansible-lint is giving an error for plays without name
    for import_playbook, add missing name.
    
    Signed-off-by: Arnaud Patard <apatard@hupstream.com>
    apatard committed Aug 30, 2022
    Configuration menu
    Copy the full SHA
    a0ce213 View commit details
    Browse the repository at this point in the history