From 8c9ea94878f663c837f0748c8c0b228b219e4ff5 Mon Sep 17 00:00:00 2001 From: Harshit Bansal Date: Mon, 30 Oct 2017 01:37:41 +0530 Subject: [PATCH] scripts: Fix an issue in `purge-old-deployments` script. We were not including the real path of the symlinks due to which we were incorrectly deleting deployments pointed by last/current/next. --- scripts/lib/zulip_tools.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/lib/zulip_tools.py b/scripts/lib/zulip_tools.py index 2797a534d5..0c5b9473db 100755 --- a/scripts/lib/zulip_tools.py +++ b/scripts/lib/zulip_tools.py @@ -213,6 +213,9 @@ def get_recent_deployments(threshold_days): except ValueError: # Always include deployments whose name is not in the format of a timestamp. recent.add(target_dir) + # If it is a symlink then include the target as well. + if os.path.islink(target_dir): + recent.add(os.path.realpath(target_dir)) if os.path.exists("/root/zulip"): recent.add("/root/zulip") return recent