The make_catalog_backup.pl sets PGUSER and PGPASSWORD env vars even if they
are not set in the bacula config. This leads to an error if postgresql is used
with IDENT authentification.
The following error message is printed:
---
pg_dump: [archiver (db)] connection to database "bacula" failed: FATAL: no
PostgreSQL user name specified in startup packet
if ($args{db_port}) {
$ENV{PGPORT}=$args{db_port};
}
-
+ if ($args{db_user}) {
+ $ENV{PGUSER}=$args{db_user};
+ }
+ if ($args{db_password}) {
+ $ENV{PGPASSWORD}=$args{db_password};
+ }
$ENV{PGDATABASE}=$args{db_name};
- $ENV{PGUSER}=$args{db_user};
- $ENV{PGPASSWORD}=$args{db_password};
exec("HOME='$wd' pg_dump -c > '$wd/$args{db_name}.sql'");
print "Error while executing postgres dump $!\n";
return 1; # in case of error