warpnet / salt-lint

A command-line utility that checks for best practices in SaltStack.
https://salt-lint.readthedocs.io/en/latest/
MIT License
152 stars 39 forks source link

Check for duplicate state IDs #261

Open ggiesen opened 3 years ago

ggiesen commented 3 years ago

Is your feature request related to a problem? Please describe. Sometimes while copying and pasting existing states to create new states, updating the state ID is missed, leading to duplicate state IDs. It'd be nice if salt-lint could catch this

Example: State ID of file_netacl_ospf is duplicated.

{% set filter = salt['capirca.get_filter_config']('cisco', 'OSPF', pillar_key='acl') %}
file_netacl_ospf:
  file.append:
    - name: /srv/config/network/{{ grains['id'] }}.ios
    - text: |
        {{ filter | indent(8) }}
    - require:
        - file_netconfig_start
    - require_in:
        - netconfig_push

{% set filter = salt['capirca.get_filter_config']('cisco', 'OSPFv6', pillar_key='acl') %}
file_netacl_ospf:
  file.append:
    - name: /srv/config/network/{{ grains['id'] }}.ios
    - text: |
        {{ filter | indent(8) }}
    - require:
        - file_netconfig_start
    - require_in:
        - netconfig_push

Describe the solution you'd like Have salt-lint check for duplicate state IDs

Describe alternatives you've considered Stop being stupid/lazy? ;)