mysql-formula/mysql/files/mysql-clients.cnf
Heinz Wiesinger 0febad19c1 Add better support for a config directory with split config files.
This adds optional support for having split configuration files
within a config directory, most commonly /etc/my.cnf.d.
2015-10-05 21:50:19 +02:00

40 lines
1.3 KiB
INI

# DO NOT CHANGE THIS FILE!
# This config is generated by SALTSTACK
# and all change will be overrided on next salt call
{#-
===== FETCH DATA =====
-#}
{%- from "mysql/defaults.yaml" import rawmap with context -%}
{%- from "mysql/supported_sections.yaml" import supported_sections with context -%}
{%- set datamap = salt['grains.filter_by'](rawmap, grain='os', merge=salt['pillar.get']('mysql:clients:lookup')) -%}
{#-
===== COMBINE DATA =====
-#}
{%- set goodParamList = datamap.clients_config.sections -%}
{%- for section_name in supported_sections -%}
{%- set sectdict = datamap.clients_config.sections[section_name] | default({}) -%}
{%- for mparam, mvalue in salt['pillar.get']('mysql:clients:'+section_name, {}).items() -%}
{%- set mparamUnderscore = mparam | replace('-','_') -%}
{%- do sectdict.update({mparamUnderscore:mvalue}) -%}
{%- endfor -%}
{%- do goodParamList.update({section_name:sectdict}) -%}
{%- endfor -%}
{#-
===== PRINT DATA =====
-#}
{%- for sname,sdata in goodParamList.items() -%}
{%- if sdata %}
[{{ sname }}]
{%- for mparam, mvalue in sdata.items()|default([])|sort -%}
{%- set indents = 40 - mparam|count %}
{% if mvalue == "noarg_present" -%}
{{ mparam }}
{%- else -%}
{{ mparam }}{{ '='|indent(indents, true) }} {{ mvalue }}
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{%- endfor %}
{{ datamap.clients_config.append | default('') }}