From f08c875015e0800c73581ca247c70b7dc2e23c59 Mon Sep 17 00:00:00 2001 From: zhujinhe Date: Wed, 3 Jun 2015 12:16:29 +0800 Subject: [PATCH] fix invoke issues of Jinja Macros example 1.'php_ini' not defined in /srv/pillar/php.sls, {{ salt.pillar.get('php_ini', {}) | json() }} gets empty value. 2.no section defined, should be 'section_name'. 3.remove empty line. --- doc/topics/development/conventions/formulas.rst | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/doc/topics/development/conventions/formulas.rst b/doc/topics/development/conventions/formulas.rst index 55e9f580f8..d5f39fa297 100644 --- a/doc/topics/development/conventions/formulas.rst +++ b/doc/topics/development/conventions/formulas.rst @@ -680,10 +680,11 @@ example, the following macro could be used to write a php.ini config file: .. code-block:: yaml - PHP: - engine: 'On' - short_open_tag: 'Off' - error_reporting: 'E_ALL & ~E_DEPRECATED & ~E_STRICT' + php_ini: + PHP: + engine: 'On' + short_open_tag: 'Off' + error_reporting: 'E_ALL & ~E_DEPRECATED & ~E_STRICT' ``/srv/salt/php.ini.tmpl``: @@ -691,8 +692,8 @@ example, the following macro could be used to write a php.ini config file: {% macro php_ini_serializer(data) %} {% for section_name, name_val_pairs in data.items() %} - [{{ section }}] - {% for name, val in name_val_pairs.items() %} + [{{ section_name }}] + {% for name, val in name_val_pairs.items() -%} {{ name }} = "{{ val }}" {% endfor %} {% endfor %}