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"
"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
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):
"""
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(
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(