Update sw_catalog_path for KSU create and update to be relevant to profile_type
Change-Id: I4f61c03d9c768d8ad8dd6d33c44608aa33823ca4
Signed-off-by: yshah <shahithya.y@tataelxsi.co.in>
diff --git a/osm_lcm/k8s.py b/osm_lcm/k8s.py
index 0c445f0..70dee64 100644
--- a/osm_lcm/k8s.py
+++ b/osm_lcm/k8s.py
@@ -28,6 +28,13 @@
from osm_lcm import vim_sdn
from osm_lcm.data_utils.list_utils import find_in_list
+MAP_PROFILE = {
+ "infra_controller_profiles": "infra-controllers",
+ "infra_config_profiles": "infra-configs",
+ "resource_profiles": "managed_resources",
+ "app_profiles": "apps",
+}
+
class GitOpsLcm(LcmBase):
db_collection = "gitops"
@@ -41,13 +48,6 @@
"app_profiles": "k8sapp",
}
- profile_collection_mapping = {
- "infra_controller_profiles": "k8sinfra_controller",
- "infra_config_profiles": "k8sinfra_config",
- "resource_profiles": "k8sresource",
- "app_profiles": "k8sapp",
- }
-
def __init__(self, msg, lcm_tasks, config):
self.logger = logging.getLogger("lcm.gitops")
self.lcm_tasks = lcm_tasks
@@ -1618,12 +1618,6 @@
class KsuLcm(GitOpsLcm):
db_collection = "ksus"
- profile_collection_mapping = {
- "infra_controller_profiles": "k8sinfra_controller",
- "infra_config_profiles": "k8sinfra_config",
- "resource_profiles": "k8sresource",
- "app_profiles": "k8sapp",
- }
def __init__(self, msg, lcm_tasks, config):
"""
@@ -1659,7 +1653,10 @@
if "sw_catalog_path" not in oka:
oka_id = oka["_id"]
db_oka = self.db.get_one("okas", {"_id": oka_id})
- oka["sw_catalog_path"] = f"infra-controllers/{db_oka['git_name']}"
+ oka_type = MAP_PROFILE[
+ db_oka.get("profile_type", "infra_controller_profiles")
+ ]
+ oka["sw_catalog_path"] = f"{oka_type}/{db_oka['git_name']}"
op_params.append(ksu_params)
_, workflow_name = await self.odu.launch_workflow(
@@ -1708,7 +1705,10 @@
if "sw_catalog_path" not in oka:
oka_id = oka["_id"]
db_oka = self.db.get_one("okas", {"_id": oka_id})
- oka["sw_catalog_path"] = f"infra-controllers/{db_oka['git_name']}"
+ oka_type = MAP_PROFILE[
+ db_oka.get("profile_type", "infra_controller_profiles")
+ ]
+ oka["sw_catalog_path"] = f"{oka_type}/{db_oka['git_name']}"
op_params.append(ksu_params)
_, workflow_name = await self.odu.launch_workflow(