Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ghormoon
Copy link

@ghormoon ghormoon commented Apr 16, 2021

PR progress checklist (to be filled in by reviewers)

  • Changes to documentation are appropriate (or tick if not required)
  • Changes to tests are appropriate (or tick if not required)
  • Reviews completed

What type of PR is this?

Primary type

  • [fix] A bug fix

Does this PR introduce a BREAKING CHANGE?

No.

Related issues and/or pull requests

#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 ghormoon requested a review from hatifnatt as a code owner April 16, 2021 17:57
@ghormoon ghormoon force-pushed the fix-pgsql-import branch 4 times, most recently from 224b87c to d0df979 Compare April 16, 2021 18:30
@ghormoon ghormoon changed the title fix pgsql import - use user that is guaranteed to exist and don't end psql import prematurely fix pgsql import - use user that is guaranteed to exist and don't end psql import prematurely, install gzip on sles (for zcat) Apr 16, 2021
@ghormoon ghormoon changed the title fix pgsql import - use user that is guaranteed to exist and don't end psql import prematurely, install gzip on sles (for zcat) fix pgsql import - don't end psql import prematurely, install gzip on sles (for zcat) Apr 16, 2021
@ghormoon
Copy link
Author

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 ghormoon changed the title fix pgsql import - don't end psql import prematurely, install gzip on sles (for zcat) fix pgsql import - don't end psql import prematurely, install gzip on sles (for zcat), move sql file path to defaults and fix check if tables exist in the DB Apr 19, 2021
zabbix/pgsql/schema.sls Outdated Show resolved Hide resolved
@ghormoon ghormoon force-pushed the fix-pgsql-import branch from db9bf8d to 13b31b2 Compare May 6, 2021 04:08
@ghormoon
Copy link
Author

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

@ghormoon ghormoon changed the title fix pgsql import - don't end psql import prematurely, install gzip on sles (for zcat), move sql file path to defaults and fix check if tables exist in the DB fix pgsql import - don't end psql import prematurely, install gzip on sles (for zcat), move sql file path to defaults May 11, 2021
@ghormoon ghormoon requested a review from hatifnatt May 11, 2021 17:26
@ghormoon ghormoon force-pushed the fix-pgsql-import branch from fbff3c1 to f9c6da0 Compare May 13, 2021 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants