saltstack-formulas / nginx-formula

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

More flexible & generic config #267

Open faudebert opened 4 years ago

faudebert commented 4 years ago

PR progress checklist (to be filled in by reviewers)


What type of PR is this?

Primary type

Secondary type

Does this PR introduce a BREAKING CHANGE?

No.

Related issues and/or pull requests

None.

Describe the changes you're proposing

This pull-request makes (hopefully) better use of jinja.map and allows to seamlessly rename meta-state. While not useful per se for the official repository, renaming permits easier reusability when forking the formula (ex. you want to use both original and forked formulas in your environment).

Pillar / config required to test the proposed changes

No specific pillar is required. If my changes are correct, you should not see any visible changes when applying your state.

If interested, you could test meta-state renaming (ex. mv nginx-formula/{nginx,mynginx}). Considering no other changes have been made, you should be able to use mynginx meta-state as drop-in replacement for nginx. Also note that pillar namespace defaults to the meta-state name (i.e. mynginx in that example).

Optionnaly, you can customize the formula pillar namespace by setting {meta-state-name}:pillar:namespace pillar (ex. mynginx:pillar:namespace: mynginx2).

Debug log showing how the proposed changes work

None for now.

Documentation checklist

Testing checklist

Additional context

pull-assistant[bot] commented 4 years ago
Score: 0.89

Best reviewed: commit by commit


Optimal code review plan (1 warning)

refactor(import): uniformize map.jinja imports
> `nginx/certificates.sls` 50% changes removed in refactor(pillar): na...
     refactor(certs): use jinja.map to get pillars      refactor(meta-state): use relative includes      refactor(pillar): namespace defaults to meta-state name      refactor(pillar): store defaults into yaml files      refactor(pillar): factorize some defaults

Powered by Pull Assistant. Last update 4edd99f ... 5d1addc. Read the comment docs.

myii commented 4 years ago

@sticky-note Would you mind reviewing this PR?

faudebert commented 4 years ago

Rebased on master and followed @daks advice regarding using relative includes (thanks!).

Let me know if I can do anything to help with the merge process.

sticky-note commented 3 years ago

@daks @faudebert @noelmcloughlin Sorry for latency. @faudebert Is that possible to make use of map.jinja from template-formula. I think it is the best moment to integrate this. -> https://github.com/saltstack-formulas/template-formula/blob/5d36fda7a473a5aefbf4ff80cb9747cf608771c9/TEMPLATE/map.jinja You can remove all between the REMOVEME tags and all after this line https://github.com/saltstack-formulas/template-formula/blob/5d36fda7a473a5aefbf4ff80cb9747cf608771c9/TEMPLATE/map.jinja#L54. And you can do post processing if needed after this line too. Thanks