Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions services/backup-daemon/docker/granular/pg_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,7 @@ def fetch_roles(self, database):
output, type(output), exit_code
)
)
# grep exits 1 when no lines match, which is valid (no owner roles found)
if exit_code not in (0, 1):
if exit_code != 0:
stderr.seek(0)
raise backups.BackupFailedException(
database, "\n".join(stderr.readlines())
Expand Down Expand Up @@ -541,12 +540,14 @@ def dump_roles_for_db(self, roles, database):
)
)
cmd = cmd + encrypt_cmd
p = Popen(cmd, shell=True, stdout=dump, stderr=stderr)
proc_env = os.environ.copy()
proc_env["PGPASSWORD"] = configs.postgres_password() or ""
p = Popen(cmd, shell=True, stdout=dump, stderr=stderr, env=proc_env)
output, err = p.communicate()
self.log.debug("Fetch roles command: {}".format(cmd))
exit_code = p.returncode
# grep exits 1 when no lines match, which is valid (no roles to dump)
if exit_code not in (0, 1):

if exit_code != 0:
stderr.seek(0)
raise backups.BackupFailedException(
database, "\n".join(stderr.readlines())
Expand Down
Loading