Fix postgresql.client state
postgresql state tries to run commands as postgres user even when remote
connection is being made and user does not exist, fix by overriding user
parameter
diff --git a/postgresql/_database.sls b/postgresql/_database.sls
index ff99e57..b6ff3cc 100644
--- a/postgresql/_database.sls
+++ b/postgresql/_database.sls
@@ -16,6 +16,7 @@
{%- for k, p in admin.iteritems() %}
- db_{{ k }}: {{ p }}
{%- endfor %}
+ - user: root
{%- endif %}
{%- endfor %}
@@ -29,12 +30,13 @@
- owner: {% for user in database.users %}{% if loop.first %}{{ user.name }}{% endif %}{% endfor %}
- require:
{%- for user in database.users %}
- - postgres_user: postgresql_user_{{ database_name }}_{{ user.name }}
+ - postgres_user: postgresql_user_{{ svr_name|default('localhost') }}_{{ database_name }}_{{ user.name }}
{%- endfor %}
{%- if admin is defined %}
{%- for k, p in admin.iteritems() %}
- db_{{ k }}: {{ p }}
{%- endfor %}
+ - user: root
{%- endif %}
{%- if database.initial_data is defined %}