Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/mas/devops/mas.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,41 @@ def getMasChannel(dynClient: DynamicClient, instanceId: str) -> str:
return masSubscription.spec.channel


def getAppsSubscriptionChannel(dynClient: DynamicClient, instanceId: str) -> list:
"""
Return list of installed apps with their subscribed channel
"""
try:
installedApps = []
appKinds = [
"assist",
"facilities",
"health",
"hputilities",
"iot",
"manage",
"monitor",
"mso",
"optimizer",
"safety",
"predict",
"visualinspection",
"aibroker"
]
for appKind in appKinds:
appSubscription = getSubscription(dynClient, f"mas-{instanceId}-{appKind}", f"ibm-mas-{appKind}")
if appSubscription is not None:
installedApps.append({"appId": appKind, "channel": appSubscription.spec.channel})
return installedApps
except NotFoundError:
return []
except ResourceNotFoundError:
return []
except UnauthorizedError:
logger.error("Error: Unable to get MAS app subscriptions due to failed authorization: {e}")
return []


def updateIBMEntitlementKey(dynClient: DynamicClient, namespace: str, icrUsername: str, icrPassword: str, artifactoryUsername: str = None, artifactoryPassword: str = None, secretName: str = "ibm-entitlement") -> ResourceInstance:
if secretName is None:
secretName = "ibm-entitlement"
Expand Down