Skip to content

Commit e1f5142

Browse files
committed
Updates
1 parent 1e2917b commit e1f5142

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

src/mas/devops/mas.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,18 @@
2424
logger = logging.getLogger(__name__)
2525

2626

27-
def isAirgapInstall(dynClient: DynamicClient) -> bool:
28-
try:
27+
def isAirgapInstall(dynClient: DynamicClient, checkICSP: bool = False) -> bool:
28+
if checkICSP:
29+
try:
30+
ICSPApi = dynClient.resources.get(api_version="operator.openshift.io/v1alpha1", kind="ImageContentSourcePolicy")
31+
ICSPApi.get(name="ibm-mas-and-dependencies")
32+
return True
33+
except NotFoundError:
34+
return False
35+
else:
2936
IDMSApi = dynClient.resources.get(api_version="config.openshift.io/v1", kind="ImageDigestMirrorSet")
3037
masIDMS = IDMSApi.get(label_selector="mas.ibm.com/idmsContent=ibm")
3138
return len(masIDMS.items) > 0
32-
except NotFoundError:
33-
return False
3439

3540

3641
def getDefaultStorageClasses(dynClient: DynamicClient) -> dict:

test/src/test_mas.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,9 @@ def test_entitlement_alt_name():
5656
def test_get_channel():
5757
channel = mas.getMasChannel(dynClient, "doesnotexist")
5858
assert channel is None
59+
60+
61+
def test_is_airgap_install():
62+
# The cluster we are using to test with does not have the MAS ICSP or IDMS installed
63+
assert mas.isAirgapInstall(dynClient) is False
64+
assert mas.isAirgapInstall(dynClient, checkICSP=False) is False

0 commit comments

Comments
 (0)