saltstack-formulas / zabbix-formula

http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
50 stars 121 forks source link

fix pgsql import - don't end psql import prematurely, install gzip on sles (for zcat), move sql file path to defaults #148

Open ghormoon opened 3 years ago

ghormoon commented 3 years ago

PR progress checklist (to be filled in by reviewers)


What type of PR is this?

Primary type

Related issues and/or pull requests

https://github.com/saltstack-formulas/zabbix-formula/issues/147

Describe the changes you're proposing

head -5 after psql does end the pswl import prematurely with EPIPE, so we need to wait for the command to end. removed for now, will be in separate pullrequest when dbroot_user and dbroot_pass is defined, it runs psql as user nobody, which is not guaranteed to exist on all distros. i suggest using zabbix.user, which does exist as we already installed zabbix (so we can use the sql.gz file to import) resolved with the remake of the check, uses zabbix user now install gzip on sles so we are sure zcat exists move default path to sql file to defaults.yml, so it can be overriden in osfamilymap.yml and not only pillar redone the check, so it uses psql after it is installed, similarly to what import does, not before.

Pillar / config required to test the proposed changes

remote db with dbroot_user and dbroot_pass set.

zabbix-pgsql:
  dbhost: somehostname.xxx
  dbname: zabbix
  dbuser: zabbix
  dbpassword: zabbixpass
  dbroot_user: zabbix
  dbroot_pass: zabbixpass
  dbsocket: ""

Debug log showing how the proposed changes work

removed, most relevant part moved to another pull

ghormoon commented 3 years ago

I've removed the user change, it seems on completely clean VM, it won't build the SLS if it asks for zabbix user (even though it would be used after it would be created)

ghormoon commented 3 years ago

I've rebased on the recent master and split off #151 so we can discuss that specific issue separartely