Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
export: Remove export-most-recent symlink.
Alex Vandivercf3311934832
diff --git a/zerver/lib/export.py b/zerver/lib/export.pyindex 28a98ffd505..e38395d1e86 100644--- a/zerver/lib/export.py+++ b/zerver/lib/export.py@@ -16,7 +16,6 @@ import shutilimport subprocessimport tempfilefrom collections.abc import Callable, Iterable, Mapping-from contextlib import suppressfrom datetime import datetimefrom email.headerregistry import Addressfrom functools import cache@@ -35,7 +34,6 @@ from psycopg2 import sqlimport zerver.lib.uploadfrom analytics.models import RealmCount, StreamCount, UserCount-from scripts.lib.zulip_tools import overwrite_symlinkfrom version import ZULIP_VERSIONfrom zerver.lib.avatar_hash import user_avatar_base_path_from_idsfrom zerver.lib.migration_status import MigrationStatusJson, parse_migration_status@@ -2411,8 +2409,6 @@ def do_export_realm(realm_config = get_realm_config()- create_soft_link(source=output_dir, in_progress=True)-exportable_scheduled_message_ids = get_exportable_scheduled_message_ids(realm, export_type, exportable_user_ids)@@ -2500,7 +2496,6 @@ def do_export_realm(do_common_export_processes(output_dir)logging.info("Finished exporting %s", realm.string_id)- create_soft_link(source=output_dir, in_progress=False)stats = do_write_stats_file_for_realm_export(output_dir)@@ -2532,27 +2527,6 @@ def export_attachment_table(return attachments-def create_soft_link(source: Path, in_progress: bool = True) -> None:- is_done = not in_progress- if settings.DEVELOPMENT:- in_progress_link = os.path.join(settings.DEPLOY_ROOT, "var", "export-in-progress")- done_link = os.path.join(settings.DEPLOY_ROOT, "var", "export-most-recent")- else:- in_progress_link = "/home/zulip/export-in-progress"- done_link = "/home/zulip/export-most-recent"-- if in_progress:- new_target = in_progress_link- else:- with suppress(FileNotFoundError):- os.remove(in_progress_link)- new_target = done_link-- overwrite_symlink(source, new_target)- if is_done:- logging.info("See %s for output files", new_target)--def launch_user_message_subprocesses(threads: int,output_dir: Path,diff --git a/zerver/tests/test_import_export.py b/zerver/tests/test_import_export.pyindex 422522462db..472be41c143 100644--- a/zerver/tests/test_import_export.py+++ b/zerver/tests/test_import_export.py@@ -412,7 +412,7 @@ class RealmImportExportTest(ExportFile):if export_type == RealmExport.EXPORT_FULL_WITH_CONSENT:assert exportable_user_ids is not None- with patch("zerver.lib.export.create_soft_link"), self.assertLogs(level="INFO"):+ with self.assertLogs(level="INFO"):do_export_realm(realm=realm,output_dir=output_dir,