backup: Make restore-backup work in docker.

Co-authored-by: Anders Kaseorg <anders@zulip.com>
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Vishnu KS
2020-02-29 20:59:16 +05:30
committed by Tim Abbott
parent fa2496c229
commit 18ecf9bcfa
2 changed files with 30 additions and 12 deletions

View File

@@ -116,6 +116,12 @@ def get_zulip_pwent() -> pwd.struct_passwd:
# `zulip` user as that's the correct value in production.
return pwd.getpwnam("zulip")
def get_postgres_pwent() -> pwd.struct_passwd:
try:
return pwd.getpwnam("postgres")
except KeyError:
return get_zulip_pwent()
def su_to_zulip(save_suid: bool = False) -> None:
"""Warning: su_to_zulip assumes that the zulip checkout is owned by
the zulip user (or whatever normal user is running the Zulip