fix 1210 avoid deleting single proxy charms. 14/9714/2
authortierno <alfonso.tiernosepulveda@telefonica.com>
Wed, 16 Sep 2020 14:13:06 +0000 (14:13 +0000)
committertierno <alfonso.tiernosepulveda@telefonica.com>
Fri, 18 Sep 2020 10:39:19 +0000 (10:39 +0000)
They are deleted removing the juju model

Change-Id: Ie203e3109c0ca499022e0e8bd9fd7b2c8e25d17b
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
osm_lcm/ns.py

index ab224cb..8aa36fd 100644 (file)
@@ -3219,7 +3219,6 @@ class NsLcm(LcmBase):
             self.logger.debug(logging_text + stage[1])
             # self.logger.debug("nsr_deployed: {}".format(nsr_deployed))
             for vca_index, vca in enumerate(get_iterable(nsr_deployed, "VCA")):
-                self.logger.debug("vca_index: {}, vca: {}".format(vca_index, vca))
                 config_descriptor = None
                 if not vca or not vca.get("ee_id"):
                     continue
@@ -3243,7 +3242,9 @@ class NsLcm(LcmBase):
                                              vca.get("needed_terminate"))
                 # For helm we must destroy_ee. Also for native_charm, as juju_model cannot be deleted if there are
                 # pending native charms
-                destroy_ee = "True" if vca_type in ("helm", "native_charm") else "False"
+                destroy_ee = True if vca_type in ("helm", "native_charm") else False
+                # self.logger.debug(logging_text + "vca_index: {}, ee_id: {}, vca_type: {} destroy_ee: {}".format(
+                #     vca_index, vca.get("ee_id"), vca_type, destroy_ee))
                 task = asyncio.ensure_future(
                     self.destroy_N2VC(logging_text, db_nslcmop, vca, config_descriptor, vca_index,
                                       destroy_ee, exec_terminate_primitives))
@@ -3251,13 +3252,13 @@ class NsLcm(LcmBase):
 
             # wait for pending tasks of terminate primitives
             if tasks_dict_info:
-                self.logger.debug(logging_text + 'Waiting for terminate primitive pending tasks...')
+                self.logger.debug(logging_text + 'Waiting for tasks {}'.format(list(tasks_dict_info.keys())))
                 error_list = await self._wait_for_tasks(logging_text, tasks_dict_info,
                                                         min(self.timeout_charm_delete, timeout_ns_terminate),
                                                         stage, nslcmop_id)
+                tasks_dict_info.clear()
                 if error_list:
                     return   # raise LcmException("; ".join(error_list))
-                tasks_dict_info.clear()
 
             # remove All execution environments at once
             stage[0] = "Stage 3/3 delete all."