mirror of https://github.com/zulip/zulip.git
zulip_tools: Skip the lock directory.
This is the one special directory that usually lives in deployments/ and is not a deployment. Make sure we don't treat it as a deployment.
This commit is contained in:
parent
500d81bf2c
commit
86a07baf40
|
@ -190,7 +190,10 @@ def get_recent_deployments(threshold_days):
|
||||||
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(os.path.join(DEPLOYMENTS_DIR, dir_name)):
|
if not os.path.isdir(os.path.join(DEPLOYMENTS_DIR, dir_name)):
|
||||||
# Skip things like uwsgi sockets.
|
# Skip things like uwsgi sockets, symlinks, etc.
|
||||||
|
continue
|
||||||
|
if not os.path.exists(os.path.join(DEPLOYMENTS_DIR, dir_name, "zerver")):
|
||||||
|
# Skip things like "lock" that aren't actually a deployment directory
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
date = datetime.datetime.strptime(dir_name, TIMESTAMP_FORMAT)
|
date = datetime.datetime.strptime(dir_name, TIMESTAMP_FORMAT)
|
||||||
|
|
|
@ -46,6 +46,9 @@ def get_deployments_to_be_purged(recent_deployments):
|
||||||
if not os.path.isdir(deployment):
|
if not os.path.isdir(deployment):
|
||||||
# Skip things like uwsgi sockets.
|
# Skip things like uwsgi sockets.
|
||||||
continue
|
continue
|
||||||
|
if not os.path.exists(os.path.join(deployment, "zerver")):
|
||||||
|
# Skip things like "lock" that aren't actually a deployment directory
|
||||||
|
continue
|
||||||
if deployment not in recent_deployments:
|
if deployment not in recent_deployments:
|
||||||
deployments_to_purge.add(deployment)
|
deployments_to_purge.add(deployment)
|
||||||
return deployments_to_purge
|
return deployments_to_purge
|
||||||
|
|
Loading…
Reference in New Issue