"app_profiles": "k8sapp",
}
+ profile_type_mapping = {
+ "infra-controllers": "infra_controller_profiles",
+ "infra-configs": "infra_config_profiles",
+ "managed-resources": "resource_profiles",
+ "applications": "app_profiles",
+ }
+
def __init__(self, msg, lcm_tasks, config):
self.logger = logging.getLogger("lcm.gitops")
self.lcm_tasks = lcm_tasks
)
return content_copy
+ def delete_profile_ksu(self, _id, profile_type):
+ filter_q = {"profile": {"_id": _id, "profile_type": profile_type}}
+ ksu_list = self.db.get_list("ksus", filter_q)
+ if ksu_list:
+ self.db.del_list("ksus", filter_q)
+ return
+
def cluster_kubectl(self, db_cluster):
cluster_kubeconfig = db_cluster["credentials"]
kubeconfig_path = f"/tmp/{db_cluster['_id']}_kubeconfig.yaml"
"the db_profile name is :{}".format(db_profile["name"])
)
if db_cluster["name"] == db_profile["name"]:
+ self.delete_profile_ksu(profile_id, profile_type)
self.db.del_one(db_collection, {"_id": profile_id})
else:
profile_ids.remove(profile_id)
if resource_status:
content["state"] = "DELETED"
+ profile_type = self.profile_type_mapping[content["profile_type"]]
+ self.delete_profile_ksu(profile_id, profile_type)
self.db.set_one(self.db_collection, {"_id": content["_id"]}, content)
self.db.del_one(self.db_collection, {"_id": content["_id"]})
self.logger.info(f"App Delete Exit with resource status: {resource_status}")
if resource_status:
content["state"] = "DELETED"
+ profile_type = self.profile_type_mapping[content["profile_type"]]
+ self.delete_profile_ksu(profile_id, profile_type)
self.db.set_one(self.db_collection, {"_id": content["_id"]}, content)
self.db.del_one(self.db_collection, {"_id": content["_id"]})
self.logger.info(
if resource_status:
content["state"] = "DELETED"
+ profile_type = self.profile_type_mapping[content["profile_type"]]
+ self.delete_profile_ksu(profile_id, profile_type)
self.db.set_one(self.db_collection, {"_id": content["_id"]}, content)
self.db.del_one(self.db_collection, {"_id": content["_id"]})
self.logger.info(
if resource_status:
content["state"] = "DELETED"
+ profile_type = self.profile_type_mapping[content["profile_type"]]
+ self.delete_profile_ksu(profile_id, profile_type)
self.db.set_one(self.db_collection, {"_id": content["_id"]}, content)
self.db.del_one(self.db_collection, {"_id": content["_id"]})
self.logger.info(