Skip to content

Commit 248e5e8

Browse files
Mayuri-GadhaviMayuri Goraviyala
andauthored
[patch] Fix operator state condition changes (#115)
Co-authored-by: Mayuri Goraviyala <Mayuri.Goraviyala@ibm.com>
1 parent 7a30cf7 commit 248e5e8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/mas/devops/olm.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,16 @@ def applySubscription(dynClient: DynamicClient, namespace: str, packageName: str
156156

157157
# Wait for Subscription to complete
158158
logger.debug(f"Waiting for Subscription {name} in {namespace}")
159-
subscriptionResource = subscriptionsAPI.get(name=name, namespace=namespace)
160-
while subscriptionResource.status.state != "AtLatestKnown":
159+
while True:
161160
subscriptionResource = subscriptionsAPI.get(name=name, namespace=namespace)
162-
sleep(30)
161+
state = getattr(subscriptionResource.status, "state", None)
162+
163+
if state == "AtLatestKnown":
164+
logger.debug(f"Subscription {name} in {namespace} reached state: {state}")
165+
return subscriptionResource
163166

164-
return subscriptionResource
167+
logger.debug(f"Subscription {name} in {namespace} not ready yet (state = {state}), retrying...")
168+
sleep(30)
165169

166170

167171
def deleteSubscription(dynClient: DynamicClient, namespace: str, packageName: str) -> None:

0 commit comments

Comments
 (0)