mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 16:14:02 +00:00
backup: Only pass --host and --port if non-empty.
This works around the `/usr/bin/pg_dump` failure described in the previous commit. Since we are now calling the appropriately-versioned `pg_dump` binary directly, it is no longer "necessary", but is added as a defense-in-depth.
This commit is contained in:
committed by
Tim Abbott
parent
9167b3efd7
commit
a7b8e4795d
@@ -72,12 +72,15 @@ class Command(ZulipBaseCommand):
|
|||||||
f"/usr/lib/postgresql/{major_pg_version}/bin/pg_dump",
|
f"/usr/lib/postgresql/{major_pg_version}/bin/pg_dump",
|
||||||
"--format=directory",
|
"--format=directory",
|
||||||
"--file=" + os.path.join(tmp, "zulip-backup", "database"),
|
"--file=" + os.path.join(tmp, "zulip-backup", "database"),
|
||||||
"--host=" + settings.DATABASES["default"]["HOST"],
|
|
||||||
"--port=" + settings.DATABASES["default"]["PORT"],
|
|
||||||
"--username=" + settings.DATABASES["default"]["USER"],
|
"--username=" + settings.DATABASES["default"]["USER"],
|
||||||
"--dbname=" + settings.DATABASES["default"]["NAME"],
|
"--dbname=" + settings.DATABASES["default"]["NAME"],
|
||||||
"--no-password",
|
"--no-password",
|
||||||
]
|
]
|
||||||
|
if settings.DATABASES["default"]["HOST"] != "":
|
||||||
|
pg_dump_command += ["--host=" + settings.DATABASES["default"]["HOST"]]
|
||||||
|
if settings.DATABASES["default"]["PORT"] != "":
|
||||||
|
pg_dump_command += ["--port=" + settings.DATABASES["default"]["PORT"]]
|
||||||
|
|
||||||
os.environ["PGPASSWORD"] = settings.DATABASES["default"]["PASSWORD"]
|
os.environ["PGPASSWORD"] = settings.DATABASES["default"]["PASSWORD"]
|
||||||
|
|
||||||
run(
|
run(
|
||||||
|
Reference in New Issue
Block a user