Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 4 additions & 7 deletions src/mas/devops/mas.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,11 @@ def getMasChannel(dynClient: DynamicClient, instanceId: str) -> str:
"""
Get the MAS channel from the subscription
"""
try:
masSubscription = getSubscription(dynClient, f"mas-{instanceId}-core", "ibm-mas")
masSubscription = getSubscription(dynClient, f"mas-{instanceId}-core", "ibm-mas")
if masSubscription is None:
return None
else:
return masSubscription.spec.channel
except NotFoundError:
return False
except UnauthorizedError:
logger.error("Error: Unable to verify MAS instance due to failed authorization: {e}")
return False


def updateIBMEntitlementKey(dynClient: DynamicClient, namespace: str, icrUsername: str, icrPassword: str, artifactoryUsername: str = None, artifactoryPassword: str = None, secretName: str = "ibm-entitlement") -> ResourceInstance:
Expand Down
5 changes: 5 additions & 0 deletions test/src/test_mas.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,8 @@ def test_entitlement_alt_name():
assert secret is not None
assert isinstance(secret, ResourceInstance)
assert secret.metadata.name == "ibm-entitlement-key"


def test_get_channel():
channel = mas.getMasChannel(dynClient, "doesnotexist")
assert channel is None
Loading