First attempt at fixing this pg_dumpall/restoring issue
This commit is contained in:
parent
fb4305a953
commit
b14f371c05
1 changed files with 19 additions and 8 deletions
|
@ -93,6 +93,16 @@ def restore_database_dumps(databases, log_prefix, location_config, dry_run):
|
||||||
dump_filename = dump.make_database_dump_filename(
|
dump_filename = dump.make_database_dump_filename(
|
||||||
make_dump_path(location_config), database['name'], database.get('hostname')
|
make_dump_path(location_config), database['name'], database.get('hostname')
|
||||||
)
|
)
|
||||||
|
if database['name'] == 'all':
|
||||||
|
restore_command = (
|
||||||
|
('psql', '--no-password', '--clean', '--if-exists', '--exit-on-error')
|
||||||
|
+ (('--host', database['hostname']) if 'hostname' in database else ())
|
||||||
|
+ (('--port', str(database['port'])) if 'port' in database else ())
|
||||||
|
+ (('--username', database['username']) if 'username' in database else ())
|
||||||
|
+ ('--dbname', database['name'])
|
||||||
|
+ (dump_filename,)
|
||||||
|
)
|
||||||
|
else:
|
||||||
restore_command = (
|
restore_command = (
|
||||||
('pg_restore', '--no-password', '--clean', '--if-exists', '--exit-on-error')
|
('pg_restore', '--no-password', '--clean', '--if-exists', '--exit-on-error')
|
||||||
+ (('--host', database['hostname']) if 'hostname' in database else ())
|
+ (('--host', database['hostname']) if 'hostname' in database else ())
|
||||||
|
@ -101,6 +111,7 @@ def restore_database_dumps(databases, log_prefix, location_config, dry_run):
|
||||||
+ ('--dbname', database['name'])
|
+ ('--dbname', database['name'])
|
||||||
+ (dump_filename,)
|
+ (dump_filename,)
|
||||||
)
|
)
|
||||||
|
|
||||||
extra_environment = {'PGPASSWORD': database['password']} if 'password' in database else None
|
extra_environment = {'PGPASSWORD': database['password']} if 'password' in database else None
|
||||||
analyze_command = (
|
analyze_command = (
|
||||||
('psql', '--no-password', '--quiet')
|
('psql', '--no-password', '--quiet')
|
||||||
|
|
Loading…
Reference in a new issue