-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add __env__ substitution inside file and pillar root paths #61531
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_roots
orpillar_roots
configuration to provide a "catch-all" root location to provide minions with randomsaltenv
and/orpillarenv
set. The configuration below would send minions withsaltenv
set tobase
,foo
, andbar
to 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__/salt
for each environment.New Behavior
This PR takes dynamic environments one step further so
__env__
can also be used in thefile_roots
andpillar_roots
paths. It will be replaced with the actualsaltenv
orpillarenv
and 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.