Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

backup: Don't mask temporary file errors with UnboundLocalError.

Anders Kaseorg92aba326cf56
diff --git a/zerver/management/commands/backup.py b/zerver/management/commands/backup.py
index 6aa0a90e306..b6685f3aa9e 100644
--- a/zerver/management/commands/backup.py
+++ b/zerver/management/commands/backup.py
@@ -122,18 +122,18 @@ class Command(ZulipBaseCommand):
for name, path in paths
]
- try:
- if options["output"] is None:
- tarball_path = stack.enter_context(
- tempfile.NamedTemporaryFile(
- prefix=f"zulip-backup-{timestamp}-",
- suffix=".tar.gz",
- delete=False,
- )
- ).name
- else:
- tarball_path = options["output"]
+ if options["output"] is None:
+ tarball_path = stack.enter_context(
+ tempfile.NamedTemporaryFile(
+ prefix=f"zulip-backup-{timestamp}-",
+ suffix=".tar.gz",
+ delete=False,
+ )
+ ).name
+ else:
+ tarball_path = options["output"]
+ try:
run(
[
"tar",