Commit Graph

9 Commits

Author SHA1 Message Date
Tim Byrne 027c7359ac
Merge pull request #304 from erijo/multiple-classes 2022-01-22 18:14:23 -06:00
Tim Byrne 5ae553b078
Add support for distro_family (#213)
Obtained from /etc/os-release: ID_LIKE.
Alternate attributes f & distro_family.
2022-01-22 18:05:15 -06:00
Erik Flodin 2379d63068
Support overriding architecture
In the same way as os, hostname and user.
2021-12-27 22:21:18 +01:00
Erik Flodin 42c74efbac
Add support for multiple local classes
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 #185.
2021-12-27 21:14:09 +01:00
Erik Flodin 6378fe3073
Print errors to stderr
This makes it possible to run e.g. "yadm -Y foo introspect repo
2>/dev/null" and get an empty output instead of getting the error
message about foo not being fully qualified.
2021-01-05 21:57:32 +01:00
Tim Byrne 6b068a141d
Remove superfluous f-strings 2020-12-21 17:06:14 -06:00
Tim Byrne 8efe2c8fad
Improve tests to use XDG* variables
Instead of overriding YADM_DIR via -Y, set the XDG* environment
variables.
2020-11-22 17:09:44 -06:00
Tim Byrne cfda485b34
Implement future alternate processing 2019-10-02 15:16:02 -05:00
Tim Byrne e4e956fe21
Split discovery of alternates test data into a testable function 2019-09-27 08:40:32 -05:00