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

Feature Request: Add rule for cron state validation #177

Closed apex-omontgomery closed 4 years ago

apex-omontgomery commented 4 years ago

Is your feature request related to a problem? Please describe.

cron.{present,absent} changes include some surprising gotchas, this is because the identifier defaults to the - name:

identifier
Custom-defined identifier for tracking the cron line for future crontab edits. This defaults to the state name

Require - identifier: to be present for cron.{present,absent} states which would avoid coupling action changing from identifier changing.

Describe the solution you'd like Since name defines both identifier and action by default, I'd recommend that the linter would verify that - identifier: was present. It would also verify that the - identifier: does not use any jinja templating as it's ideal that the data is not changed external the declaration.

This would make changing the actions not create duplicate crons.

Describe alternatives you've considered My personal opinion is that salt shouldn't be combining the identifier for uniqueness and the command you are running, but I feel that would be a fairly large and breaking api change.