Skip to content
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

feat(tofs): implementation for all file.managed #178

Merged
merged 1 commit into from
Sep 13, 2019

Conversation

sticky-note
Copy link
Member

No description provided.

@myii
Copy link
Member

myii commented Jun 25, 2019

@sticky-note Thanks for starting this. There's some work to be done here. Similar to the nginx-formula PR, I've gone through and done a breakdown of the changes this brings. The issues need to be addressed. Also, pillar.example will have to be extended to cover all of the relevant states in some way or another. One further idea is that applying TOFS to ng formulas is not really the best idea -- better to promote the ng first before doing this -- let's see what the other think about this (CC: @alxwr @aboe76).


php.ng.fpm.pools_config

php_fpm_pool_conf_0:
  file.managed:
     ...
     - name: /location/of/php-fpm/pool.d/mypool.conf
-    - source: salt://php/ng/files/php.ini
+    - source:
+      - salt://php/files/ABC/mypool.conf
+      - salt://php/files/ABC/php.ini
+      - salt://php/files/Debian/mypool.conf
+      - salt://php/files/Debian/php.ini
+      - salt://php/files/default/mypool.conf
+      - salt://php/files/default/php.ini
+      - salt://php/ng/files/ABC/mypool.conf
+      - salt://php/ng/files/ABC/php.ini
+      - salt://php/ng/files/Debian/mypool.conf
+      - salt://php/ng/files/Debian/php.ini
+      - salt://php/ng/files/default/mypool.conf
+      - salt://php/ng/files/default/php.ini
  • Let's restrict to php.ini during this PR.

php.ng.hhvm.config

php_hhvm_ini_config:
  file.managed:
     ...
     - name: /etc/hhvm/server.ini
-    - source: salt://php/ng/files/php.ini
+    - source:
+      - salt://php/files/ABC/server.ini
+      - salt://php/files/ABC/php.ini
+      - salt://php/files/Debian/server.ini
+      - salt://php/files/Debian/php.ini
+      - salt://php/files/default/server.ini
+      - salt://php/files/default/php.ini
+      - salt://php/ng/files/ABC/server.ini
+      - salt://php/ng/files/ABC/php.ini
+      - salt://php/ng/files/Debian/server.ini
+      - salt://php/ng/files/Debian/php.ini
+      - salt://php/ng/files/default/server.ini
+      - salt://php/ng/files/default/php.ini
  • Let's restrict to php.ini during this PR.
php_hhvm_conf_config:
  file.managed:
     ...
     - name: /etc/hhvm/php.ini
-    - source: salt://php/ng/files/php.ini
+    - source:
+      - salt://php/files/ABC/php.ini
+      - salt://php/files/ABC/php.ini
+      - salt://php/files/Debian/php.ini
+      - salt://php/files/Debian/php.ini
+      - salt://php/files/default/php.ini
+      - salt://php/files/default/php.ini
+      - salt://php/ng/files/ABC/php.ini
+      - salt://php/ng/files/ABC/php.ini
+      - salt://php/ng/files/Debian/php.ini
+      - salt://php/ng/files/Debian/php.ini
+      - salt://php/ng/files/default/php.ini
+      - salt://php/ng/files/default/php.ini
  • Let's restrict to php.ini during this PR.

php.ng.fpm.config

php_fpm_ini_config:
  file.managed:
     ...
     - name: /location/of/php-fpm/php.ini
-    - source: salt://php/ng/files/php.ini
+    - source:
+      - salt://php/files/ABC/php.ini
+      - salt://php/files/ABC/php.ini
+      - salt://php/files/Debian/php.ini
+      - salt://php/files/Debian/php.ini
+      - salt://php/files/default/php.ini
+      - salt://php/files/default/php.ini
+      - salt://php/ng/files/ABC/php.ini
+      - salt://php/ng/files/ABC/php.ini
+      - salt://php/ng/files/Debian/php.ini
+      - salt://php/ng/files/Debian/php.ini
+      - salt://php/ng/files/default/php.ini
+      - salt://php/ng/files/default/php.ini
  • The duplications need to be removed here.
php_fpm_conf_config:
  file.managed:
     ...
     - name: /location/of/php-fpm/config.conf
-    - source: salt://php/ng/files/php.ini
+    - source:
+      - salt://php/files/ABC/config.conf
+      - salt://php/files/ABC/php.ini
+      - salt://php/files/Debian/config.conf
+      - salt://php/files/Debian/php.ini
+      - salt://php/files/default/config.conf
+      - salt://php/files/default/php.ini
+      - salt://php/ng/files/ABC/config.conf
+      - salt://php/ng/files/ABC/php.ini
+      - salt://php/ng/files/Debian/config.conf
+      - salt://php/ng/files/Debian/php.ini
+      - salt://php/ng/files/default/config.conf
+      - salt://php/ng/files/default/php.ini
  • Let's restrict to php.ini during this PR.

php.ng.apache2.ini

php_apache2_ini:
  file.managed:
     ...
     - name: /etc/php/7.0/apache2/php.ini
-    - source: salt://php/ng/files/php.ini
+    - source:
+      - salt://php/files/ABC/php.ini
+      - salt://php/files/ABC/php.ini
+      - salt://php/files/Debian/php.ini
+      - salt://php/files/Debian/php.ini
+      - salt://php/files/default/php.ini
+      - salt://php/files/default/php.ini
+      - salt://php/ng/files/ABC/php.ini
+      - salt://php/ng/files/ABC/php.ini
+      - salt://php/ng/files/Debian/php.ini
+      - salt://php/ng/files/Debian/php.ini
+      - salt://php/ng/files/default/php.ini
+      - salt://php/ng/files/default/php.ini
  • The duplications need to be removed here.

php.ng.cli.ini

php_cli_ini:
  file.managed:
     ...
     - name: /location/of/php-cli/php.ini
-    - source: salt://php/ng/files/php.ini
+    - source:
+      - salt://php/files/ABC/php.ini
+      - salt://php/files/ABC/php.ini
+      - salt://php/files/Debian/php.ini
+      - salt://php/files/Debian/php.ini
+      - salt://php/files/default/php.ini
+      - salt://php/files/default/php.ini
+      - salt://php/ng/files/ABC/php.ini
+      - salt://php/ng/files/ABC/php.ini
+      - salt://php/ng/files/Debian/php.ini
+      - salt://php/ng/files/Debian/php.ini
+      - salt://php/ng/files/default/php.ini
+      - salt://php/ng/files/default/php.ini
  • The duplications need to be removed here.

php.ng.xcache.ini

php_xcache_ini:
  file.managed:
     ...
     - name: /location/of/php-xcache/php.ini
-    - source: salt://php/ng/files/php.ini
+    - source:
+      - salt://php/files/ABC/php.ini
+      - salt://php/files/ABC/php.ini
+      - salt://php/files/Debian/php.ini
+      - salt://php/files/Debian/php.ini
+      - salt://php/files/default/php.ini
+      - salt://php/files/default/php.ini
+      - salt://php/ng/files/ABC/php.ini
+      - salt://php/ng/files/ABC/php.ini
+      - salt://php/ng/files/Debian/php.ini
+      - salt://php/ng/files/Debian/php.ini
+      - salt://php/ng/files/default/php.ini
+      - salt://php/ng/files/default/php.ini
  • The duplications need to be removed here.

@aboe76
Copy link
Member

aboe76 commented Jun 25, 2019

@sticky-note Thanks for starting this. There's some work to be done here. Similar to the nginx-formula PR, I've gone through and done a breakdown of the changes this brings. The issues need to be addressed. Also, pillar.example will have to be extended to cover all of the relevant states in some way or another. One further idea is that applying TOFS to ng formulas is not really the best idea -- better to promote the ng first before doing this -- let's see what the other think about this (CC: @alxwr @aboe76).

@myii I think the order of merging TOFS shouldn't matter that much, if it's merge first in ng and later the ng will be merged in the non-ng formula. The only downside I can think of is that you have to handle the same code twice, to compensate for the restructuring of the pillar data.

@myii
Copy link
Member

myii commented Jun 25, 2019

@aboe76 Sure, it can still work. My issue is with the excessive entries under the source, which can't be avoided when working with ng formulas. Once they've been promoted, we no longer face this issue.

@aboe76
Copy link
Member

aboe76 commented Jun 25, 2019

@myii, you have a valid point there. let wait with TOFS after merging ng

@myii
Copy link
Member

myii commented Jun 25, 2019

@aboe76 The problem here is that semantic-release hasn't been enabled for this formula, which really should be done before promoting ng.

@n-rodriguez
Copy link
Member

better to promote the ng first before doing this

👍

@n-rodriguez
Copy link
Member

hasn't been enabled for this formula, which really should be done before promoting ng.

I'm working on it : #179
But I got one question : what should I test? The old formula or the new one? (ng)

@myii
Copy link
Member

myii commented Jun 26, 2019

@n-rodriguez If the objective is to promote ng, then it's only worth testing that. I think the right thing to do would be to ask the main maintainers of the formula to see if they're ready for ng to be promoted (e.g. @alxwr @aboe76). Otherwise, we may be pushing too quickly.

@myii
Copy link
Member

myii commented Jun 26, 2019

@n-rodriguez But there's no reason why we can't get the basic semantic-release up and running. In fact, I already started the process in anticipation of your PR yesterday, only to be disappointed to find that it was a WIP!

@n-rodriguez
Copy link
Member

@n-rodriguez But there's no reason why we can't get the basic semantic-release up and running

I agree

In fact, I already started the process in anticipation of your PR yesterday, only to be disappointed to find that it was a WIP!

It's almost finished ;)

@myii
Copy link
Member

myii commented Jun 28, 2019

Thanks to @n-rodriguez, semantic-release is now active for this formula (merged in #179, with updates in #180). So what's next? Continue with this PR or promote ng first?

@n-rodriguez
Copy link
Member

So what's next? Continue with this PR or promote ng first?

I'd suggest to merge #177 and close #175 first.

@myii
Copy link
Member

myii commented Jun 29, 2019

I'd suggest to merge #177 and close #175 first.

@n-rodriguez Efffectively done: #177 (comment). So now onto the next stage.

@n-rodriguez
Copy link
Member

n-rodriguez commented Jun 29, 2019

@n-rodriguez Efffectively done: #177 (comment). So now onto the next stage.

Great job! 👍

@sticky-note sticky-note changed the title feat(TOFS): TOFS Impl. for fpm and fpm-pools feat(TOFS): TOFS Impl. for ini cfgs and fpm-pools Jul 1, 2019
@sticky-note sticky-note force-pushed the feat/tofs branch 2 times, most recently from dd70f0f to 356b8d3 Compare July 1, 2019 05:11
@sticky-note
Copy link
Member Author

Thanks to all for your work and reviews
@myii Rebased and Force pushed your requested changes,
How about passing crafted URLs array in a uniq filter before returning them in files_switch?

@sticky-note sticky-note changed the title feat(TOFS): TOFS Impl. for ini cfgs and fpm-pools feat(tofs): impl. for ini cfgs and fpm-pools Jul 1, 2019
@sticky-note sticky-note force-pushed the feat/tofs branch 2 times, most recently from e2cd7dc to 71b59fd Compare July 9, 2019 04:29
@sticky-note
Copy link
Member Author

sticky-note commented Jul 9, 2019

Brought some modification on my last push:

  • Added tofs_lookup parameter to php_ini macro so we can pass in tofs lookup for files_switch
  • Introduced tplroot on files I modified
  • Updated pillar.example to reflect these changes and removed TOFS comments outside TOFS block
  • Added {%- on files I modified
    @myii @n-rodriguez @aboe76 What to do next ?

@n-rodriguez
Copy link
Member

@sticky-note great work 👍

@myii @n-rodriguez @aboe76 What to do next ?

IMHO It would be nice to :

  1. get rid of add support to install xmlrpc with xml module #175
  2. promote ng
  3. merge this PR

@sticky-note
Copy link
Member Author

sticky-note commented Jul 10, 2019

What about the serialize macro ?
config objects are serialized when sent to jinja template so we retrieve an array of odicts on our custom templates.
Commit was done 5 years ago -> c2435a3
What is the effective need of this ?
Is it still relevant to use this or we can do something more TOFS friendly or we can refactor this entire part?
Look forward to have your advices.

@myii
Copy link
Member

myii commented Jul 10, 2019

  1. get rid of add support to install xmlrpc with xml module #175

@n-rodriguez Can I get your opinions on #175 (comment) and #175 (comment)? If you still think it's not worthwhile, we can request a closure of that PR.

@sticky-note Thanks for your patience, I'll try to get around to checking your latest changes soon.

Copy link
Member

@myii myii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sticky-note Thanks for rebasing this. There are a number of changes, many of them necessary. After these are made, we can look at testing this PR for appropriate results.

@myii
Copy link
Member

myii commented Sep 5, 2019

@sticky-note When you rebase this, could you do it on the latest upstream? We want to get the tests running from the merge of #197.

Update: and the merge of #195.

@myii
Copy link
Member

myii commented Sep 5, 2019

@sticky-note Please also copy across docs/TOFS_pattern.rst from the template-formula as well.

myii added a commit to myii/ssf-formula that referenced this pull request Sep 5, 2019
myii added a commit to myii/ssf-formula that referenced this pull request Sep 5, 2019
myii added a commit to myii/ssf-formula that referenced this pull request Sep 5, 2019
@sticky-note sticky-note force-pushed the feat/tofs branch 2 times, most recently from d0b0ffd to bab5f08 Compare September 8, 2019 22:48
@sticky-note
Copy link
Member Author

sticky-note commented Sep 8, 2019

@myii, Done requested changes:

  • Maintain layout consistency when using the php_ini and files_switch macro.
  • Fixed the use of version.
  • Updated php/libtofs.jinja
  • Copied docs/TOFS_pattern.rst from template-formula
  • Changed v1_path_prefix to use_subpath
  • Removed inserted /ng while copied import paths
  • Rebased with latest master commit

@myii
Copy link
Member

myii commented Sep 9, 2019

@sticky-note Brilliant, thanks. I'll try to look at this over the next day or two.

Copy link
Member

@myii myii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sticky-note Just a couple of changes from the eyeball review. I'll run this over the next day or two as mentioned above.

@sticky-note
Copy link
Member Author

@myii

@myii
Copy link
Member

myii commented Sep 13, 2019

@sticky-note Don't worry, I haven't forgotten! I'm just working through some other stuff, as I get time to work on it. This PR is near the top of the list.

Copy link
Member

@myii myii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a missing comma but otherwise fine.


php_apache2_ini:
{{ php_ini(php.lookup.apache2.ini, php.apache2.ini.opts, settings) }}
{{ php_ini(php.lookup.apache2.ini,
'php_apache2_ini'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'php_apache2_ini'
'php_apache2_ini',

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sticky-note Don't worry, I've fixed it and rebased.

- Implementation of libtofs on ini macro, pools_config and apache2 mod_php.conf
+ Introduction of tplroot on modified files
+ `{%-` consistency when possible
Copy link
Member

@myii myii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sticky-note Diff is as expected, this is ready to be merged after the tests have passed:

--- Before
+++ After
@@ -3,7 +3,10 @@
 php_apache2_ini:
   file.managed:
     - name: /etc/php/5.6/apache2/php.ini
-    - source: salt://php/files/php.ini
+    - source:
+      - salt://php/files/ba9615bfb8b4/php.ini
+      - salt://php/files/Debian/php.ini
+      - salt://php/files/default/php.ini
     - template: jinja
 [DEBUG   ] Rendered data from file: /tmp/kitchen/var/cache/salt/minion/files/base/php/apache2/install.sls:
 # -*- coding: utf-8 -*-
@@ -14,7 +17,13 @@
     - pkgs: ["libapache2-mod-php5.6", "libapache2-mod-php5.6", "libapache2-mod-php7.3"]
 /usr/local/etc/apache24/modules.d/050_mod_php.conf:
   file.managed:
-    - source: salt://php/apache2/files/mod_php.conf.jinja
+    - source:
+      - salt://php/apache2/files/ba9615bfb8b4/mod_php.conf.jinja
+      - salt://php/apache2/files/Debian/mod_php.conf.jinja
+      - salt://php/apache2/files/default/mod_php.conf.jinja
+      - salt://php/files/ba9615bfb8b4/mod_php.conf.jinja
+      - salt://php/files/Debian/mod_php.conf.jinja
+      - salt://php/files/default/mod_php.conf.jinja
     - template: jinja
     - makedirs: true
     - require_in:
@@ -28,24 +37,36 @@
 php_cli_ini_5.6:
   file.managed:
     - name: /etc/php/5.6/cli/php.ini
-    - source: salt://php/files/php.ini
+    - source:
+      - salt://php/files/ba9615bfb8b4/php.ini
+      - salt://php/files/Debian/php.ini
+      - salt://php/files/default/php.ini
     - template: jinja
 php_cli_ini_7.3:
   file.managed:
     - name: /etc/php/7.3/cli/php.ini
-    - source: salt://php/files/php.ini
+    - source:
+      - salt://php/files/ba9615bfb8b4/php.ini
+      - salt://php/files/Debian/php.ini
+      - salt://php/files/default/php.ini
     - template: jinja
 [DEBUG   ] Rendered data from file: /tmp/kitchen/var/cache/salt/minion/files/base/php/fpm/config.sls:
 # Manages the php-fpm main ini file
 php_fpm_ini_config_5.6:
   file.managed:
     - name: /etc/php/5.6/fpm/php.ini
-    - source: salt://php/files/php.ini
+    - source:
+      - salt://php/files/ba9615bfb8b4/php.ini
+      - salt://php/files/Debian/php.ini
+      - salt://php/files/default/php.ini
     - template: jinja
 php_fpm_conf_config_5.6:
   file.managed:
     - name: /etc/php/5.6/fpm/php-fpm.conf
-    - source: salt://php/files/php.ini
+    - source:
+      - salt://php/files/ba9615bfb8b4/php.ini
+      - salt://php/files/Debian/php.ini
+      - salt://php/files/default/php.ini
     - template: jinja
     - context:
  config: [{"global": [{"pid": "/var/run/php5.6-fpm.pid"}, {"error_log": "/var/log/php5.6-fpm.log"}]}, {"include": "/etc/php/5.6/fpm/pool.d/*.conf"}]
@@ -59,12 +80,18 @@
 php_fpm_ini_config_7.3:
   file.managed:
     - name: /etc/php/7.3/fpm/php.ini
-    - source: salt://php/files/php.ini
+    - source:
+      - salt://php/files/ba9615bfb8b4/php.ini
+      - salt://php/files/Debian/php.ini
+      - salt://php/files/default/php.ini
     - template: jinja
 php_fpm_conf_config_7.3:
   file.managed:
     - name: /etc/php/7.3/fpm/php-fpm.conf
-    - source: salt://php/files/php.ini
+    - source:
+      - salt://php/files/ba9615bfb8b4/php.ini
+      - salt://php/files/Debian/php.ini
+      - salt://php/files/default/php.ini
     - template: jinja
     - context:
  config: [{"global": [{"pid": "/var/run/php7.3-fpm.pid"}, {"error_log": "/var/log/php7.3-fpm.log"}]}, {"include": "/etc/php/7.3/fpm/pool.d/*.conf"}]
@@ -81,14 +108,20 @@
 php_fpm_pool_conf_0:
   file.managed:
     - name: /etc/php/5.6/fpm/pool.d/radius-admin.conf
-    - source: salt://php/files/php.ini
+    - source:
+      - salt://php/files/ba9615bfb8b4/php.ini
+      - salt://php/files/Debian/php.ini
+      - salt://php/files/default/php.ini
     - template: jinja
     - context:
  config: [{"radius-admin": [{"user": "www-data"}, {"group": "www-data"}, {"listen": "/tmp/php-fpm-radius-admin.sock"}, {"listen.mode": "0666"}, {"pm": "static"}, {"pm.max_children": 3}, {"pm.max_requests": 500}, {"pm.status_path": "/php-status"}, {"ping.path": "/php-ping"}, {"catch_workers_output": "yes"}, {"security.limit_extensions": ".php"}, {"php_admin_value[date.timezone]": "Europe/Paris"}]}]
 php_fpm_pool_conf_1:
   file.managed:
     - name: /etc/php/7.3/fpm/pool.d/ldap-admin.conf
-    - source: salt://php/files/php.ini
+    - source:
+      - salt://php/files/ba9615bfb8b4/php.ini
+      - salt://php/files/Debian/php.ini
+      - salt://php/files/default/php.ini
     - template: jinja
     - context:
  config: [{"ldap-admin": [{"user": "www-data"}, {"group": "www-data"}, {"listen": "/tmp/php-fpm-ldap-admin2.sock"}, {"listen.mode": "0666"}, {"pm": "static"}, {"pm.max_children": 3}, {"pm.max_requests": 500}, {"pm.status_path": "/php-status"}, {"ping.path": "/php-ping"}, {"catch_workers_output": "yes"}, {"security.limit_extensions": ".php"}, {"php_admin_value[date.timezone]": "Europe/Paris"}]}]
@@ -97,21 +130,30 @@
 php_hhvm_ini_config:
   file.managed:
     - name: /etc/hhvm/server.ini
-    - source: salt://php/files/php.ini
+    - source:
+      - salt://php/files/ba9615bfb8b4/php.ini
+      - salt://php/files/Debian/php.ini
+      - salt://php/files/default/php.ini
     - template: jinja
     - context:
  config: [{"pid": "/var/run/hhvm/pid"}, {"hhvm.server.port": "9000"}, {"hhvm.server.type": "fastcgi"}, {"hhvm.server.default_document": "index.php"}, {"hhvm.log.use_log_file": "true"}, {"hhvm.log.file": "/var/log/hhvm/error.log"}, {"hhvm.repo.central.path": "/var/run/hhvm/hhvm.hhbc"}]
 php_hhvm_conf_config:
   file.managed:
     - name: /etc/hhvm/php.ini
-    - source: salt://php/files/php.ini
+    - source:
+      - salt://php/files/ba9615bfb8b4/php.ini
+      - salt://php/files/Debian/php.ini
+      - salt://php/files/default/php.ini
     - template: jinja
 [DEBUG   ] Rendered data from file: /tmp/kitchen/var/cache/salt/minion/files/base/php/xcache/ini.sls:
 # Manages the php cli main ini file
 php_xcache_ini:
   file.managed:
     - name: /etc/php/conf.d/xcache.ini
-    - source: salt://php/files/php.ini
+    - source:
+      - salt://php/files/ba9615bfb8b4/php.ini
+      - salt://php/files/Debian/php.ini
+      - salt://php/files/default/php.ini
     - template: jinja
     - context:
  config: [{"xcache-common": [{"extension": "xcache.so"}]}, {"xcache": [{"xcache.size": "90M"}]}]

@myii myii merged commit 1802ac5 into saltstack-formulas:master Sep 13, 2019
@myii
Copy link
Member

myii commented Sep 13, 2019

@sticky-note Finally merged, thanks for your patience.

myii added a commit to myii/ssf-formula that referenced this pull request Sep 13, 2019
@saltstack-formulas-travis

🎉 This PR is included in version 1.2.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@sticky-note
Copy link
Member Author

@myii Last thing, actually this way, TOFS is not usable in personal templates because of https://github.com/saltstack-formulas/php-formula/pull/178/files#diff-07689a57bcdaf996c5d9e3bd9099e831R15 without including original template or importing the php_block macro.
How can we handle this problem ?

@myii
Copy link
Member

myii commented Sep 16, 2019

@sticky-note Do you mean something like this?

--- master
+++ proposed
@@ -5,14 +5,14 @@
 {%- from tplroot ~ "/macro.jinja" import sls_block, serialize %}
 {%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
 
-{% macro php_ini(filename, tofs_lookup, opts={}, settings={}) %}
+{% macro php_ini(filename, tofs_lookup, opts={}, settings={}, template='jinja') %}
   file.managed:
     {{ sls_block(opts) }}
     - name: {{ filename }}
     - source: {{ files_switch(['php.ini'],
                               tofs_lookup
               ) }}
-    - template: jinja
+    - template: {{ template }}
     - context:
         config: {{ serialize(odict(settings)) }}
 {%- endmacro -%}

Or do you mean supplying the template from the pillar/config as well? Meaning, that it should be provided to the files_switch macro?

For clarity, could you provide a sample state of what you are hoping to achieve? It will be easier to discuss that way. Please provide it in a rendered example, similar to the examples shown in #178 (review), e.g.

php_xcache_ini:
  file.managed:
    - name: /etc/php/conf.d/xcache.ini
    - source:
      - salt://php/files/ba9615bfb8b4/php.ini
      - salt://php/files/Debian/php.ini
      - salt://php/files/default/php.ini
    - template: jinja
    - context:
        config: [{"xcache-common": [{"extension": "xcache.so"}]}, {"xcache": [{"xcache.size": "90M"}]}]

@myii
Copy link
Member

myii commented Sep 16, 2019

CC: @baby-gnu (starting from #178 (comment)).

@baby-gnu
Copy link
Contributor

Hello @myii, I'm not sure to understand the problem @sticky-note is speaking about.

@myii
Copy link
Member

myii commented Sep 16, 2019

@baby-gnu Thanks, just wanted to draw this to your attention in case we need to improve libtofs a little more. Let's wait for a response from @sticky-note first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants