Fix deploymentManager profiles not set in conf file 02/9502/1
authorZhang Rong(Jon) <rong.zhang@windriver.com>
Tue, 8 Nov 2022 01:41:02 +0000 (09:41 +0800)
committerZhang Rong(Jon) <rong.zhang@windriver.com>
Tue, 8 Nov 2022 01:41:02 +0000 (09:41 +0800)
Signed-off-by: Zhang Rong(Jon) <rong.zhang@windriver.com>
Change-Id: Ice973c45bb86a102b9fe90661512cdc2c4b06fb9

o2common/config/config.py

index a2907c4..690f4e9 100644 (file)
@@ -348,9 +348,12 @@ def get_auth_provider():
 
 def get_dms_support_profiles():
     profiles = config.conf.API.DMS_SUPPORT_PROFILES
-    profiles = profiles.replace("'", "").replace(
-        '"', "").replace('[', "").replace(']', "")
-    profiles = profiles.split(',')
+    if profiles is None or profiles == '':
+        profiles = []
+    elif "[" in profiles and "]" in profiles:
+        profiles = profiles.replace("'", "").replace(
+            '"', "").replace('[', "").replace(']', "")
+        profiles = profiles.split(',')
     if 'native_k8sapi' not in profiles:
         profiles.append('native_k8sapi')
     return profiles