Skip to content

Commit 61fe6da

Browse files
authored
Merge branch 'stable' into monthlyupdate
2 parents da95cc2 + edb1e99 commit 61fe6da

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

src/mas/devops/olm.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,18 @@ def applySubscription(dynClient: DynamicClient, namespace: str, packageName: str
206206
starting_csv=startingCSV
207207
)
208208
subscription = yaml.safe_load(renderedTemplate)
209-
subscriptionsAPI.apply(body=subscription, namespace=namespace)
209+
210+
# apply should work regardless of if the subscription already exists or not,
211+
# however if two parallel processes call it at the same time it can result
212+
# in a 409 error in that case trying again will resolve the issue
213+
try:
214+
subscriptionsAPI.apply(body=subscription, namespace=namespace)
215+
except Exception as e:
216+
if "409" in str(e) or "AlreadyExists" in str(e):
217+
logger.warning(f"Subscription {name} already exists and produced a conflict, retrying the apply")
218+
subscriptionsAPI.apply(body=subscription, namespace=namespace)
219+
else:
220+
raise
210221

211222
# Wait for InstallPlan to be created
212223
logger.debug(f"Waiting for {packageName}.{namespace} InstallPlans")

0 commit comments

Comments
 (0)