purge-old-deployments: Never purge the currently running deployment.

(imported from commit edccfc908f50a66e5c214bca8a5418625ed64bf0)
This commit is contained in:
Tim Abbott 2013-10-31 13:22:23 -04:00
parent adc5771062
commit bc19be977a
1 changed files with 4 additions and 0 deletions

View File

@ -17,6 +17,10 @@ for filename in os.listdir(DEPLOYMENTS_DIR):
try: try:
date = datetime.datetime.strptime(filename, TIMESTAMP_FORMAT) date = datetime.datetime.strptime(filename, TIMESTAMP_FORMAT)
if date < one_week_ago: if date < one_week_ago:
if (os.path.abspath(os.readlink("/home/zulip/deployments/current")) ==
os.path.abspath(os.path.join(DEPLOYMENTS_DIR, filename))):
# Never purge the currently running deployment
continue
to_purge.append(filename) to_purge.append(filename)
except ValueError: except ValueError:
pass pass