-
Notifications
You must be signed in to change notification settings - Fork 416
feat(tofs): First implementation #238
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
Conversation
@sticky-note Thanks for this PR. Initial comments, I haven't looked at this in any detail yet:
-feat(tofs): First imp. for servers_config and snippets
+feat(tofs): first imp. for servers_config and snippets |
Thanks for this @sticky-note, it's definitely taking shape. I've worked through from each of the entry points, comparing before and after. I've used
In a few comments below, I've recommended reducing the number of template file names. Ultimately, the user is able to customise these using the There's obviously some duplicates below, due to formula execution and loops that are used. These will only require fixing in one place.
|
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.
As outlined in #238 (comment).
CC: @aboe76 @noelmcloughlin @daks. Since this is a fairly significant PR, I would appreciate it if any of you could take a look. |
@sticky-note Please include this fix as well: saltstack-formulas/template-formula#124. |
My suggestion is to keep this PR as a pure refactor and then apply this in a later PR. |
Thanks @myii for this review, I updated PR according to your suggestions . |
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.
This is definitely taking shape now and just a few changes from my side -- great work.
{% else %} | ||
{% set source_path = 'salt://nginx/files/server.conf' %} | ||
{% endif %} | ||
{% if settings.enabled == True %} |
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 haven't looked into this but is there a reason you removed the settings.config != None
?
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 removed this to be able to not specify a config object so that flat files can be retrieved by TOFS without this param set empty
@@ -138,7 +144,7 @@ nginx_server_available_dir: | |||
{% else %} | |||
{{ manage_status(server, settings.enabled, False) }} | |||
{% endif %} | |||
{% if settings.config != None and settings.enabled == True %} | |||
{% if settings.enabled == True %} |
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 haven't looked into this but is there a reason you removed the settings.config != None
?
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 removed this to be able to not specify a config object so that flat files can be retrieved by TOFS without this param set empty
pillar.example
Outdated
@@ -84,6 +85,8 @@ nginx: | |||
- upstream netdata: | |||
- server: 127.0.0.1:19999 | |||
- keepalive: 64 | |||
file_retrieved_by_tofs: {} # File retrieved by TOFS, |
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.
How would this be used exactly?
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.
Don't know how to explain that, it will search files :
nginx/files/ABC/file_retrieved_by_tofs
nginx/files/ABC/server.conf
nginx/files/default/file_retrieved_by_tofs
nginx/files/default/server.conf
without modifying TOFS parameters
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.
Isn't this already provided by the tofs
section of the pillar? I.e.:
tofs:
...
source_files:
...
nginx_snippet_file_managed:
- file_retrieved_by_tofs
- server.conf
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.
This is the default behavior without specifying anything in pillar
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.
Still a few more issues! Don't worry, this happens with large, important PRs.
pillar.example
Outdated
# source_files: | ||
# template-config-file-file-managed: | ||
# - 'example_alt.tmpl' | ||
# - 'example_alt.tmpl.jinja' |
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.
These four lines should be removed since the section is shown below.
pillar.example
Outdated
- role | ||
- osfinger | ||
- os | ||
- os_family |
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.
This files_switch
section is better commented out since we don't really want the extra I/O unless necessary.
pillar.example
Outdated
@@ -84,6 +85,8 @@ nginx: | |||
- upstream netdata: | |||
- server: 127.0.0.1:19999 | |||
- keepalive: 64 | |||
file_retrieved_by_tofs: {} # File retrieved by TOFS, |
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.
Isn't this already provided by the tofs
section of the pillar? I.e.:
tofs:
...
source_files:
...
nginx_snippet_file_managed:
- file_retrieved_by_tofs
- server.conf
@aboe76 @noelmcloughlin @daks I'd really appreciate a second review on this PR. It's pretty much complete now so can be tested to ensure it is satisfactory. |
@myii I'll try to find some time to review this PR, but I've no real knowledge of TOFS :-/ |
First implementation of TOFS for: nginx_config, passenger_config, servers_config and snippets Introduced tplroot on modified files as well Fixed GH link of nginx.conf file in docs/TOFS_pattern.rst Fixed test for snippets name pillar
Brilliant work @sticky-note -- this has been merged. |
🎉 This PR is included in version 1.1.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
## [3.1.1](v3.1.0...v3.1.1) (2019-07-25) ### Bug Fixes * **tofs:** prepend the config-based `source_files` to the default ([3483e76](3483e76)), closes [/github.com/saltstack-formulas/nginx-formula/pull/247#issuecomment-514262549](https://github.com//github.com/saltstack-formulas/nginx-formula/pull/247/issues/issuecomment-514262549) [#151](#151) ### Documentation * **tofs:** ensure merged will all recent changes ([6a614d9](6a614d9)) * **tofs:** update from `nginx-formula` ([23a221e](23a221e)), closes [/github.com/saltstack-formulas/nginx-formula/pull/238#discussion_r289124365](https://github.com//github.com/saltstack-formulas/nginx-formula/pull/238/issues/discussion_r289124365)
docs/TOFS_pattern.rst
Edited