-
Notifications
You must be signed in to change notification settings - Fork 85
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
fix(tofs): prepend the config-based source_files
to the default
#152
fix(tofs): prepend the config-based source_files
to the default
#152
Conversation
b778901
to
88ecbbe
Compare
@baby-gnu If this implementation is accepted, I'll make the small changes necessary to the main TOFS document as well. |
88ecbbe
to
cb1f1bf
Compare
@baby-gnu Actually, I've just gone ahead and done added the changes to the documentation as well. |
Thanks, I'm reviewing it. |
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.
I agree with the changes but it's quite hard to see and understand the impact.
I set the kitchen log_level
to debug and the difference between master and this PR is
--- master.out 2019-07-24 10:55:07.711690476 +0200
+++ pr.out 2019-07-24 10:55:21.223788394 +0200
@@ -3,9 +3,21 @@
- name: /etc/template-formula.conf
- source:
- salt://template/files/any/path/can/be/used/here/example.tmpl.jinja
- - salt://template/files/ed264f5f1c9d/example.tmpl.jinja
+ - salt://template/files/any/path/can/be/used/here/example.tmpl
+ - salt://template/files/any/path/can/be/used/here/example.tmpl.jinja
+ - salt://template/files/cae0aef658c3/example.tmpl.jinja
+ - salt://template/files/cae0aef658c3/example.tmpl
+ - salt://template/files/cae0aef658c3/example.tmpl.jinja
+ - salt://template/files/Debian-9/example.tmpl.jinja
+ - salt://template/files/Debian-9/example.tmpl
- salt://template/files/Debian-9/example.tmpl.jinja
- salt://template/files/Debian/example.tmpl.jinja
+ - salt://template/files/Debian/example.tmpl
+ - salt://template/files/Debian/example.tmpl.jinja
- salt://template/files/Debian/example.tmpl.jinja
+ - salt://template/files/Debian/example.tmpl
+ - salt://template/files/Debian/example.tmpl.jinja
+ - salt://template/files/default/example.tmpl.jinja
+ - salt://template/files/default/example.tmpl
- salt://template/files/default/example.tmpl.jinja
- mode: 644
I think we could modify the pillar.example
to make more evident the differences:
diff --git a/pillar.example b/pillar.example
index 583a0d6..4b44ec3 100644
--- a/pillar.example
+++ b/pillar.example
@@ -42,15 +42,10 @@ template:
# dirs:
# files: files_alt
# default: default_alt
- # source_files:
- # template-config-file-file-managed:
- # - 'example_alt.tmpl'
- # - 'example_alt.tmpl.jinja'
-
- # For testing purposes
source_files:
template-config-file-file-managed:
- - 'example.tmpl.jinja'
+ - 'example_alt.tmpl'
+ - 'example_alt.tmpl.jinja'
# Just for testing purposes
winner: pillar
This will result in the following diff between master and the proposed changes of this PR:
--- master.out 2019-07-24 10:55:07.711690476 +0200
+++ alt.out 2019-07-24 10:55:33.151873999 +0200
@@ -2,10 +2,28 @@
file.managed:
- name: /etc/template-formula.conf
- source:
+ - salt://template/files/any/path/can/be/used/here/example_alt.tmpl
+ - salt://template/files/any/path/can/be/used/here/example_alt.tmpl.jinja
+ - salt://template/files/any/path/can/be/used/here/example.tmpl
- salt://template/files/any/path/can/be/used/here/example.tmpl.jinja
- - salt://template/files/ed264f5f1c9d/example.tmpl.jinja
+ - salt://template/files/cae0aef658c3/example_alt.tmpl
+ - salt://template/files/cae0aef658c3/example_alt.tmpl.jinja
+ - salt://template/files/cae0aef658c3/example.tmpl
+ - salt://template/files/cae0aef658c3/example.tmpl.jinja
+ - salt://template/files/Debian-9/example_alt.tmpl
+ - salt://template/files/Debian-9/example_alt.tmpl.jinja
+ - salt://template/files/Debian-9/example.tmpl
- salt://template/files/Debian-9/example.tmpl.jinja
+ - salt://template/files/Debian/example_alt.tmpl
+ - salt://template/files/Debian/example_alt.tmpl.jinja
+ - salt://template/files/Debian/example.tmpl
- salt://template/files/Debian/example.tmpl.jinja
+ - salt://template/files/Debian/example_alt.tmpl
+ - salt://template/files/Debian/example_alt.tmpl.jinja
+ - salt://template/files/Debian/example.tmpl
- salt://template/files/Debian/example.tmpl.jinja
+ - salt://template/files/default/example_alt.tmpl
+ - salt://template/files/default/example_alt.tmpl.jinja
+ - salt://template/files/default/example.tmpl
- salt://template/files/default/example.tmpl.jinja
- mode: 644
Regards.
@myii : |
@n-rodriguez I'm sorry, I don't quite understand the question. I use PillarStack as well, so I'll be able to check what you're asking. Do you mean supplying different values to be processed by |
I mean implementing |
* saltstack-formulas/nginx-formula#247 (comment) - The main issue is that the `nginx-formula` has dynamic values being used as the default `source_files` -- there is no way to provide this from the pillar/config in a sensible fashion - Prepending to this default (rather than overriding it) resolves this problem entirely, without adding excessive entries to the `source` * Closes saltstack-formulas#151
cb1f1bf
to
3483e76
Compare
@baby-gnu Resolved, to ensure that --- before
+++ after
@@ -1,4 +1,7 @@
- source:
- salt://template/files/ABC/example.tmpl.jinja
+ - salt://template/files/ABC/example.tmpl
- salt://template/files/Debian/example.tmpl.jinja
+ - salt://template/files/Debian/example.tmpl
- salt://template/files/default/example.tmpl.jinja
+ - salt://template/files/default/example.tmpl |
@baby-gnu If you're happy with this, please go ahead and merge it. I think everyone else leaves TOFS for us two to play with! Meaning, I don't think anyone else is waiting to review this... |
@n-rodriguez I can definitely see the angle on this. In a way, it would be nice to defer the processing to PillarStack instead. The biggest problem I can see is that it makes a dependency on (having to configure) PillarStack. And we're trying to avoid all dependencies for our formulas, at least at the current time. Right now, I've got three components doing the same sort of thing but at different levels in the system:
Combining all of these to use the same processing and directory structure? That would be very interesting. |
Thanks for the review and merge @baby-gnu. I'm about to propagate these changes to all of the formulas. I already started (saltstack-formulas/chrony-formula#23) but now I'll include this as well in one go. |
🎉 This PR is included in version 3.1.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
nginx-formula
has dynamic values being used as the defaultsource_files
-- there is no way to provide this from the pillar/config in a sensible fashionsource
CC: @baby-gnu.