-
Notifications
You must be signed in to change notification settings - Fork 176
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 support for multiple local classes #304
Merged
TheLocehiliosan
merged 1 commit into
TheLocehiliosan:develop
from
erijo:multiple-classes
Jan 22, 2022
Merged
Add support for multiple local classes #304
TheLocehiliosan
merged 1 commit into
TheLocehiliosan:develop
from
erijo:multiple-classes
Jan 22, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 tasks
A local class is set with: $ yadm config local.class cls1 More classes can be added with: $ yadm config --add local.class cls2 $ yadm config --add local.class cls3 Any of cls1, cls2 and cls3 can be used in an alternate condition. For templates, the existing variable yadm.class/YADM_CLASS is set to the last class (i.e. cls3) to remain compatible with how it works today and with what the following command gives: $ yadm config local.class For the default template processor there is no explicit yadm.classes variable. Instead a yadm.class condition will check against all classes. For the other processors, a new template variable YADM_CLASSES will be set to all classes separated by newline. For jinja2 templates a class can be checked with: {%- if "cls" in YADM_CLASSES.split("\n") %} For esh templates the logic is a bit more complex, but it is possible to do. Fixes TheLocehiliosan#185.
6693c24
to
42c74ef
Compare
@TheLocehiliosan: I've rebased this on top of latest develop. I haven't updated the documentation since I'm not sure how it should be described (or even if). Suggestions are welcome. |
@erijo - Another high quality PR 👍 This has been merged into develop, and will be part of the next release. I'll figure out the documentation. |
TheLocehiliosan
added a commit
that referenced
this pull request
Jan 23, 2022
TheLocehiliosan
added a commit
that referenced
this pull request
Feb 21, 2022
* Support architecture for alternates/templates (#202, #203, #393) * Support distro_family for alternates/templates (#213) * Support setting multiple classes (#185, #304) * Support environment variables in default template processor (#347) * Update version command to include Bash & Git versions (#377)
TheLocehiliosan
added a commit
that referenced
this pull request
Mar 12, 2022
* Support architecture for alternates/templates (#202, #203, #393) * Support distro_family for alternates/templates (#213) * Support setting multiple classes (#185, #304) * Support environment variables in default template processor (#347) * Update version command to include Bash & Git versions (#377)
TheLocehiliosan
added a commit
that referenced
this pull request
Mar 16, 2022
* Support architecture for alternates/templates (#202, #203, #393) * Support distro_family for alternates/templates (#213) * Support setting multiple classes (#185, #304) * Support environment variables in default template processor (#347) * Update version command to include Bash & Git versions (#377)
8 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Make it possible to have multiple local classes.
A local class is set with:
$ yadm config local.class cls1
More classes can be added with:
Any of cls1, cls2 and cls3 can be used in an alternate condition.
For templates, the existing variable yadm.class/YADM_CLASS is set to the last class (i.e. cls3) to remain compatible with how it works today and with what the following command gives:
$ yadm config local.class
For the default template processor there is no explicit yadm.classes variable. Instead a yadm.class condition will check against all classes.
For the other processors, a new template variable YADM_CLASSES will be set to all classes separated by newline. For jinja2 templates a class can be checked with:
{%- if "cls" in YADM_CLASSES.split("\n") %}
For esh templates the logic is a bit more complex, but it is possible to do.
TODO: no documentation has been updated. I'll update it later if this seems like a good idea.
What issues does this PR fix or reference?
Previous Behavior
Only one class was supported.
New Behavior
Multiple classes are supported.
Have tests been written for this change?
Yes
Have these commits been signed with GnuPG?
Yes
Please review yadm's Contributing Guide for best practices.