Skip to content

--syntax-check isn't catching indent errors for with_items: #1924

Open
@VorlMaldor

Description

@VorlMaldor
ISSUE TYPE
  • Bug Report
SUMMARY

when using the ansible-navigator run --syntax-check the check does not catch indent issues with with_items:

ANSIBLE-NAVIGATOR VERSION
ansible-navigator 24.9.0

CONFIGURATION
LOG FILE

TASK [copy repo file to /etc/yum.repos.d/local_rhel9.repo] ********************************************
fatal: [lab-cn]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'item' is undefined. 'item' is undefined\n\nThe error appears to be in '/home/sboni/ansible/lab/install-repo.yaml': line 5, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: "copy repo file to /etc/yum.repos.d/local_rhel9.repo"\n ^ here\n"}

STEPS TO REPRODUCE

use ansible.builtin.copy and with_items: but have with_items being at the indent of the rest of the copy section like this

  1 - name: "copy repo files and update subscription-manager plugin"
  2   hosts: rhel9
  3   tasks:
  4
  5   - name: "copy repo file to /etc/yum.repos.d/local_rhel9.repo"
  6     ansible.builtin.copy:
  7       src: "{{ item.src }}"
  8       dest: "{{ item.dest }}"
  9       owner: root
 10       group: root
 11       mode: 644
 12
 13       with_items:
 14       - { src: '/etc/yum.repos.d/local_rhel9.repo',dest: '/etc/yum.repos.d/local_rhel9.repo' }
 15       - { src: '/etc/yum/pluginconf.d/subscription-manager.conf',dest: '/etc/yum/pluginconf.d/subsc    ription-manager.conf' }

then run ansible-navigator run .yaml --syntax-check

EXPECTED RESULTS

I would expect syntax-check to tell me there was an issue with the indent

ACTUAL RESULTS

ansible-navigator comes back with no errors

ADDITIONAL INFORMATION

ansible-navigator images ee-supported-rhel8 -m stdout

  • created: 2 weeks ago
    execution_environment: true
    full_name: registry.redhat.io/ansible-automation-platform-25/ee-supported-rhel8:latest
    image_id: 6b2954c3d094

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugResearched, reproducible, committed to fix

    Type

    No type

    Projects

    • Status

      No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions