Skip to content

Commit d0df979

Browse files
committed
fix(pgsql): fix pgsql import - guaranteed user, don't end psql too soon
1 parent 5c81ca1 commit d0df979

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

zabbix/osfamilymap.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ Suse:
167167
pgsql:
168168
pkgs:
169169
- postgresql
170+
- gzip
170171
sql_file: /usr/share/doc/packages/zabbix-server-pgsql/create.sql.gz
171172

172173

zabbix/pgsql/schema.sls

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# Connection args required only if dbroot_user and dbroot_pass defined.
1717
{% set connection_args = {} -%}
1818
{% if dbroot_user and dbroot_pass -%}
19-
{% set connection_args = {'runas': 'nobody', 'host': dbhost, 'user': dbroot_user, 'password': dbroot_pass} -%}
19+
{% set connection_args = {'runas': zabbix.user, 'host': dbhost, 'user': dbroot_user, 'password': dbroot_pass} -%}
2020
{% endif -%}
2121
2222
# Check is there any tables in database.
@@ -51,7 +51,7 @@ upload_sql_dump:
5151
5252
import_sql:
5353
cmd.run:
54-
- name: zcat {{ sql_file }} | psql | head -5
54+
- name: zcat {{ sql_file }} | psql | { head -5; cat >/dev/null; }
5555
- runas: {{ zabbix.user }}
5656
- env:
5757
- PGUSER: {{ dbuser }}

0 commit comments

Comments
 (0)