warpnet / salt-lint

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

Check in the names argument is a list in the pkg.installed module #314

Open roaldnefs opened 1 year ago

roaldnefs commented 1 year ago

When using the pkg.installed module it's possible to installed multiple packages by providing a list, e.g.:

example_packages:
  pkg.installed:
    - names: ['package', 'other_package'] 

When the code is updated to only install a single package this can be rewritten to the following:

example_packages:
  pkg.installed:
    - name: package

But when the names argument is kept it will result in the error The 'names' argument in state 'example_packages in SLS 'example' needs to be formed as a list`:

example_packages:
  pkg.installed:
    - names: package

This can be prevented by checking if the names argument in the pkg.installed modules actually contains a list.