mirror of https://github.com/zulip/zulip.git
purge-old-deployments: Remove an unnecessary check.
Deployments whose name is not in the format of a timestamp are always included in the `recent_deployments` and are not deleted, hence we don't need to check for them explicitly.
This commit is contained in:
parent
a6caf30ca7
commit
90f6ffa23d
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue