[DRE-maint] Bug#901379: gitlab: postinst script should not call psql if database is not managed by dbconfig-common

devel at sumpfralle.de devel at sumpfralle.de
Fri Dec 11 22:53:27 GMT 2020


Hello,

I encounter the same problem (psql directly used in postinst script) during
every package upgrade.

The main problem (in my case) is the misdetection of an uninitialized database
(see "db_relations" in /usr/lib/gitlab/scripts/rake-tasks.sh).
The script checks via "psql" (locally), whether the database is already
populated. Since the database is empty, the initial database setup is started
(this time using rake for interacting with the configured external database).
This initialization fails, since the real database is not empty.
Thus postinst fails.

My current workaround is to run the following loop in a separate shell:

 while sleep 1; do sed -i 's/db_relations"/db_relationsXXX"/' \
   /usr/lib/gitlab/scripts/rake-tasks.sh; done

This overrides the test for an empty database.
Another approach could be to simply populate the local (unused) database.

The proper solution would be to use the *configured* database connection
instead of running "psql" directly. Maybe this could be done via rake?

If you could give me any hints in this direction, then I could propose a patch
for fixing the database accesses in the postinst other related scripts.

Cheers,
Lars



More information about the Pkg-ruby-extras-maintainers mailing list