Skip to content

Commit d3f8b2f

Browse files
authored
[patch] Close timing window when checking deployment status (#16)
1 parent 1179b12 commit d3f8b2f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/mas/devops/ocp.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,10 @@ def waitForDeployment(dynClient: DynamicClient, namespace: str, deploymentName:
107107
retries += 1
108108
try:
109109
deployment = deploymentAPI.get(name=deploymentName, namespace=namespace)
110-
if deployment.status.readyReplicas > 0:
110+
if deployment.status.readyReplicas is not None and deployment.status.readyReplicas > 0:
111+
# Depending on how early we are checking the deployment the status subresource may not
112+
# have even been initialized yet, hence the check for "is not None" to avoid a
113+
# NoneType and int comparison TypeError
111114
foundReadyDeployment = True
112115
else:
113116
logger.debug("Waiting 5s for deployment {deploymentName} to be ready before checking again ...")

0 commit comments

Comments
 (0)