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.
This commit is contained in:
Harshit Bansal 2017-10-30 01:37:41 +05:30 committed by Tim Abbott
parent 493529d981
commit 8c9ea94878
1 changed files with 3 additions and 0 deletions

View File

@ -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