saltstack-formulas / nginx-formula

Nginx Salt Formula
http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
163 stars 419 forks source link

fix: prevent running of states deprecated in `v1.0.0` #236

Closed myii closed 5 years ago

myii commented 5 years ago

Cross-references:


Note: There is one common state before and after: nginx/init.sls. For that, I've checked for the presence of nginx:ng in the map instead.

Note: Implementation based on this PR.

daks commented 5 years ago

First: find a way to prevent the formula from running before having migrated settings is a great idea!

Second: you're only checking that nginx.common state is called to prevent this. I'm not sure this is sufficient, because people calling nginx directly will not be affected. Can we find other way to detect it: maybe with a specific pillar in nginx or detecting nginx.ng?

myii commented 5 years ago

@daks Apologies, the implementation isn't clear because I started editing other lines as well to convert to {%-. In any case, you'll see that I'm specifically checking for nginx.ng when someone tries to run nginx. As for all of the other files, they are the entry points that existed before the change to v1.0.0, so they will be prevented from being run. Essentially, all bases are covered, except for someone trying to run the old nginx -- that will now trigger the new states and we can discuss (in a further PR) what to check in the pillar to confirm they are on the old style pillar. In the meantime, this PR will cover most of the potential problems, especially for nginx.ng. If there's no objection, I believe this should be merged ASAP to protect against unwanted breakages.

n-rodriguez commented 5 years ago

looks good to me

myii commented 5 years ago

Thanks for the review, @n-rodriguez.

myii commented 5 years ago

And thanks to you as well, @daks. Can either of you merge this please (CC: @n-rodriguez)?

myii commented 5 years ago

Actually, since it's important and potentially time-critical, I've gone ahead and merged based on the the two approvals. Thanks again to everyone involved in reviewing and discussing these issues.

saltstack-formulas-travis commented 5 years ago

:tada: This PR is included in version 1.0.4 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

johnkeates commented 5 years ago

Thanks everyone, perhaps we can take this and note it down somewhere in the template formula docs? Haven't checked if we have a deprecation section in there yet, but we may want to.

myii commented 5 years ago

@johnkeates Thanks for the suggestion, I've appended that to the documentation section in the "superlist" issue in the template-formula (link shown above).