-
Notifications
You must be signed in to change notification settings - Fork 37
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
feature(tofs): lookup files directory in “tpldir” hierarchy #37
feature(tofs): lookup files directory in “tpldir” hierarchy #37
Conversation
This result in the following networkd:
file.recurse:
- name: /etc/systemd/network
- user: root
- group: root
- template: jinja
- source:
- salt://systemd/networkd/files/any/path/can/be/used/here/network
- salt://systemd/networkd/files/salt-formula.ci.local/network
- salt://systemd/networkd/files/Ubuntu-18.04/network
- salt://systemd/networkd/files/Ubuntu/network
- salt://systemd/networkd/files/Debian/network
- salt://systemd/networkd/files/default/network
- salt://systemd/files/any/path/can/be/used/here/network
- salt://systemd/files/salt-formula.ci.local/network
- salt://systemd/files/Ubuntu-18.04/network
- salt://systemd/files/Ubuntu/network
- salt://systemd/files/Debian/network
- salt://systemd/files/default/network
- clean: True
- dir_mode: 755
- file_mode: 644
- include_empty: True
- listen_in:
- service: networkd |
Without user configuration, the “libtofs.jinja” lookup the “files” directory under “tplroot” with is the base directory of the current formula unless the “v1_path_prefix” is set. Now, we lookup the directory in each sub-directory from the sub-directory of the current SLS (“tpldir”) to the top level directory of the formula (“tplroot”). This permit to support natively the multi-components formula.
68762f5
to
8d5b5ea
Compare
@baby-gnu shall I merge first the other PR, before this one? |
@aboe76 if I understood correctly, @myii asked to do this one first. |
@baby-gnu Sorry for the delay, I'll be checking this PR shortly. @aboe76 As laid out here, the plan is to benefit from the improvement in this formula and then "backport" it to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent PR, approved really. The requested changes are only aesthetic.
|
||
For example, the following ``formula.component.config`` SLS: | ||
|
||
.. code-block:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. code-block:: | |
.. code-block:: sls |
|
||
.. code-block:: | ||
|
||
{%- from "formula/libtofs.jinja" import files_switch with context -%} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{%- from "formula/libtofs.jinja" import files_switch with context -%} | |
{%- from "formula/libtofs.jinja" import files_switch with context %} |
) | ||
}} | ||
|
||
will be rendered on a ``Debian`` named ``salt-formula.ci.local`` as: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will be rendered on a ``Debian`` named ``salt-formula.ci.local`` as: | |
will be rendered on a ``Debian`` minion named ``salt-formula.ci.local`` as: |
|
||
will be rendered on a ``Debian`` named ``salt-formula.ci.local`` as: | ||
|
||
.. code-block:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. code-block:: | |
.. code-block:: sls |
.. code-block:: | ||
|
||
formula configuration file: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@baby-gnu One further question: what about removing the To be clear, I mean removing |
@baby-gnu @aboe76 Another issue that we need to finalise. When this functionality was first produced in saltstack-formulas/template-formula#86, it produced the - source:
- salt://systemd/files/ABC/network
- salt://systemd/files/Debian/network
- salt://systemd/files/default/network
- salt://systemd/networkd/files/ABC/network
- salt://systemd/networkd/files/Debian/network
- salt://systemd/networkd/files/default/network After my saltstack-formulas/template-formula#86 (comment), @baby-gnu reversed the order as requested, to now produce: - source:
- salt://systemd/networkd/files/ABC/network
- salt://systemd/networkd/files/Debian/network
- salt://systemd/networkd/files/default/network
- salt://systemd/files/ABC/network
- salt://systemd/files/Debian/network
- salt://systemd/files/default/network In the same PR, @daks raised concerns about I/O costs (saltstack-formulas/template-formula#86 (comment)). So my question in, which order is preferable:
While number 1 makes sense, in reality those |
@myii I think if you document sub-component => main component (using |reverse) and let the maintainer who implements tofs be the just, if one or the other is necessary. |
It can be done but this is a breaking change. For example, I personnaly always “hook” my personal gitfs_remotes:
- https://myserver/my-systemd-config.git
- https://myserver/systemd-formula.git
My {%- from "systemd/map.jinja" import systemd with context %}
{%- from "systemd/libtofs.jinja" import files_switch with context %} If another user does the same thing as me, she will have troubles if she used the If everybody agree for this breaking changes, I'll remove it. Regards. |
I agree to avoid the automatic timesyncd:
file.managed:
- name: /etc/systemd/timesyncd.conf
- user: root
- group: root
- mode: 644
- template: jinja
- source: {{ files_switch(['timesyncd.conf'],
lookup='timesyncd',
component='timesyncd'
)
}} The |
@baby-gnu As for this specific PR, I believe it is an important and excellent contribution. Let's leave |
@baby-gnu Merged, let's get this important contribution out there. I'll suggest the changes above in a separate PR. Thanks for this! |
🎉 This PR is included in version 0.12.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
docs(tofs): apply remaining comments from PR #37
## [0.12.1](v0.12.0...v0.12.1) (2019-05-27) ### Documentation * **tofs:** apply remaining comments from PR [#37](#37) ([d665676](d665676))
@baby-gnu It's a good thing we didn't remove |
Without user configuration, the “libtofs.jinja” lookup the “files”
directory under “tplroot” with is the base directory of the current
formula unless the “v1_path_prefix” is set.
Now, we lookup the directory in each sub-directory from the
sub-directory of the current SLS (“tpldir”) to the top level directory
of the formula (“tplroot”).
This permit to support natively the multi-components formula.