File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2424logger = 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
3641def getDefaultStorageClasses (dynClient : DynamicClient ) -> dict :
Original file line number Diff line number Diff line change @@ -56,3 +56,9 @@ def test_entitlement_alt_name():
5656def 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
You can’t perform that action at this time.
0 commit comments