diff --git a/scripts/purge-old-deployments b/scripts/purge-old-deployments index 4cfb107dec..5341a5c413 100755 --- a/scripts/purge-old-deployments +++ b/scripts/purge-old-deployments @@ -1,6 +1,5 @@ #!/usr/bin/env python3 import argparse -import datetime import os import subprocess import sys @@ -42,14 +41,11 @@ def get_deployments_to_be_purged(recent_deployments): for deployment in os.listdir(DEPLOYMENTS_DIR)]) deployments_to_purge = set() for deployment in all_deployments: + # Deployments whose name is not in the format of a timestamp are + # always included in the recent_deployments and are not deleted. if not os.path.isdir(deployment): # Skip things like uwsgi sockets. continue - try: - datetime.datetime.strptime(deployment, TIMESTAMP_FORMAT) - except ValueError: - # Never purge deployments whose name is not in the format of a timestamp. - continue if deployment not in recent_deployments: deployments_to_purge.add(deployment) return deployments_to_purge