get_recent_deployments: Skip uwsgi socket and friends.

This fixes an exception when running clean-venv-caches in production.
This commit is contained in:
Tim Abbott 2017-08-27 18:16:15 -07:00
parent e38ac00f3c
commit 1a1df29053
1 changed files with 3 additions and 0 deletions

View File

@ -179,6 +179,9 @@ def get_recent_deployments(threshold_days):
recent = set() recent = set()
threshold_date = datetime.datetime.now() - datetime.timedelta(days=threshold_days) threshold_date = datetime.datetime.now() - datetime.timedelta(days=threshold_days)
for dir_name in os.listdir(DEPLOYMENTS_DIR): for dir_name in os.listdir(DEPLOYMENTS_DIR):
if not os.path.isdir(dir_name):
# Skip things like uwsgi sockets.
continue
try: try:
date = datetime.datetime.strptime(dir_name, TIMESTAMP_FORMAT) date = datetime.datetime.strptime(dir_name, TIMESTAMP_FORMAT)
if date >= threshold_date: if date >= threshold_date: