siemens / postgres-backup-s3

PostgreSQL Docker companion for periodic backups to S3
MIT License
0 stars 0 forks source link

Restore does not return error code when failing to connect to database #6

Open dlouzan opened 1 year ago

dlouzan commented 1 year ago

On a recent test I got this successful job:

$ kubectl logs job/some-restore-job
Finding latest backup...
Fetching backup from S3...
download: s3://some.dump to ./db.dump
Restoring from backup...
pg_restore: error: connection to database "somedb" failed: could not connect to server: Operation timed out
        Is the server running on host "some.db.foo" (1.2.3.4) and accepting
        TCP/IP connections on port 5432?
Restore complete.

This is caused by not using the -e option on the restore script. Funnily, upstream has this comment, which lol:

set -u # `-e` omitted intentionally, but i can't remember why exactly :'(

/cc @max-wittig