Map Pillar dicts for PostgreSQL entities to the Salt state arguments
This commit is contained in:
21
postgres/macros.jinja
Normal file
21
postgres/macros.jinja
Normal file
@@ -0,0 +1,21 @@
|
||||
{%- from "postgres/map.jinja" import postgres with context -%}
|
||||
|
||||
{%- macro format_state(name, state, kwarg) %}
|
||||
|
||||
{%- do kwarg.update({'name': name}) %}
|
||||
{%- if 'ensure' in kwarg %}
|
||||
{%- set ensure = kwarg.pop('ensure') %}
|
||||
{%- endif %}
|
||||
{%- if 'user' not in kwarg and state != 'postgres_schema' %}
|
||||
{%- do kwarg.update({'user': postgres.user}) %}
|
||||
{%- endif -%}
|
||||
|
||||
{{ state }}-{{ name }}:
|
||||
{{ state }}.{{ ensure|default('present') }}:
|
||||
{%- for k, v in kwarg|dictsort() %}
|
||||
- {{ k }}: {{ v }}
|
||||
{%- endfor %}
|
||||
|
||||
{%- endmacro %}
|
||||
|
||||
# vim: ft=sls
|
||||
Reference in New Issue
Block a user