Clean-up of resources created in ODU workflows
Change-Id: Ib2051d5844841d6469a4dc3e854ff2ef88a36a87
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
diff --git a/osm_lcm/odu_libs/vim_mgmt.py b/osm_lcm/odu_libs/vim_mgmt.py
index e82bc34..8014f0c 100644
--- a/osm_lcm/odu_libs/vim_mgmt.py
+++ b/osm_lcm/odu_libs/vim_mgmt.py
@@ -164,6 +164,7 @@
secret_key,
secret_value,
)
+
# Additional params for the workflow
providerconfig_name = f"{vim_name}-config"
provider_type = content["vim_type"]
@@ -203,6 +204,29 @@
return workflow_name
+async def clean_items_cloud_credentials_create(self, op_id, op_params, content):
+ self.logger.info("Clean items cloud_credentials_create Enter")
+ items = {
+ "secrets": [
+ {
+ "name": f"create-providerconfig-{content['_id']}",
+ "namespace": "osm-workflows",
+ }
+ ]
+ }
+ try:
+ await self.clean_items(items)
+ return True, "OK"
+ except Exception as e:
+ return False, f"Error while cleaning items: {e}"
+
+
+async def clean_items_cloud_credentials_update(self, op_id, op_params, content):
+ self.logger.info("Clean items cloud_credentials_update Enter")
+ self.logger.info(f"Operation {op_id}. Params: {op_params}. Content: {content}")
+ return await self.clean_items_cloud_credentials_create(op_id, op_params, content)
+
+
async def check_create_cloud_credentials(self, op_id, op_params, content):
self.logger.info(f"Operation {op_id}. Params: {op_params}. Content: {content}")
return True, "OK"