Add __env__ substitution inside file and pillar root paths#61531
Conversation
|
re-run all |
|
@nicholasmhughes Sorry, CI is currently broken but there is a PR up to fix it. I'll rerun after that is merged and then likely approve this. |
|
re-run pr-ubuntu-2004-arm64-py3-pytest |
|
re-run pr-centos-7-x86_64-py3-pycryptodome-pytest |
|
re-run pr-centos-8-x86_64-py3-pytest |
|
test failure looks unrelated, will review then |
|
re-run pr-ubuntu-2004-arm64-py3-pytest |
|
re-run pr-centos-7-x86_64-py3-m2crypto-pytest |
|
@MKLeb is everything good with this PR? |
|
Looks good on my end. I've sent it around internally to have others take a look as well, but if there are no concerns then it should be good to go. |
|
Sorry, just took another look at the test code. A couple of simple changes to make it more "pytest-y" if you will. |
|
re-run pr-arch-lts-x86_64-py3-pytest |
1 similar comment
|
re-run pr-arch-lts-x86_64-py3-pytest |
|
I'm happy to see my ideas from #55747 were implemented and merged! 👍 I think this new My PR #55812 shows how this might be accomplished: - stack_config_files += cfgs
+ stack_config_files += [cfg.replace("__env__", pillarenv) for cfg in cfgs]@nicholasmhughes would you be willing to cooperate on this? |
|
@morgana2313 , happy to help in any way I can! Feel free to reach out on Slack if it's easier to coordinate that way. |
What does this PR do?
Adds
__env__substitution inside file and pillar root pathsWhat issues does this PR fix or reference?
Addresses the spirit of this issue: #55747, but not the exact implementation of the resulting PR (#55812)... which may be abandoned at this time.
Previous Behavior
The
__env__designation could be used as a key underneath thefile_rootsorpillar_rootsconfiguration to provide a "catch-all" root location to provide minions with randomsaltenvand/orpillarenvset. The configuration below would send minions withsaltenvset tobase,foo, andbarto the same location:However, there wasn't a way to dynamically set a different path location for each environment. The configuration below would be literally interpreted as
/srv/__env__/saltfor each environment.New Behavior
This PR takes dynamic environments one step further so
__env__can also be used in thefile_rootsandpillar_rootspaths. It will be replaced with the actualsaltenvorpillarenvand searched for states and/or data to provide to the minion. For instance, this configuration:is now equivalent to this static configuration:
Merge requirements satisfied?
[NOTICE] Bug fixes or features added to Salt require tests.
Commits signed with GPG?
Yes
Please review Salt's Contributing Guide for best practices.
See GitHub's page on GPG signing for more information about signing commits with GPG.