Swap if-else in restore_database_dump in postgresql hook for cleanliness

This commit is contained in:
Jakub Jirutka 2023-04-14 16:29:26 +02:00
parent dfccc1b94a
commit f0f43174c6
1 changed files with 3 additions and 3 deletions

View File

@ -221,9 +221,9 @@ def restore_database_dump(database_config, log_prefix, location_config, dry_run,
tuple(psql_command if all_databases else pg_restore_command)
+ ('--no-password',)
+ (
('--if-exists', '--exit-on-error', '--clean', '--dbname', database['name'])
if not all_databases
else ('--no-psqlrc', '--set', 'ON_ERROR_STOP=on')
('--no-psqlrc', '--set', 'ON_ERROR_STOP=on')
if all_databases
else ('--if-exists', '--exit-on-error', '--clean', '--dbname', database['name'])
)
+ (('--host', database['hostname']) if 'hostname' in database else ())
+ (('--port', str(database['port'])) if 'port' in database else ())