Add logs 07/12007/6
authorDavid Garcia <david.garcia@canonical.com>
Fri, 6 May 2022 10:26:20 +0000 (12:26 +0200)
committergarciadav <david.garcia@canonical.com>
Tue, 24 May 2022 15:15:47 +0000 (17:15 +0200)
Change-Id: If831d758b463ce0a2592cd651277c5ec7dabc26a
Signed-off-by: David Garcia <david.garcia@canonical.com>
n2vc/libjuju.py
n2vc/n2vc_juju_conn.py

index bca3665..14e8467 100644 (file)
@@ -1326,11 +1326,12 @@ class Libjuju:
         model = None
         try:
             if not await self.model_exists(model_name, controller=controller):
         model = None
         try:
             if not await self.model_exists(model_name, controller=controller):
+                self.log.warn(f"Model {model_name} doesn't exist")
                 return
 
                 return
 
-            self.log.debug("Destroying model {}".format(model_name))
-
+            self.log.debug(f"Getting model {model_name} to be destroyed")
             model = await self.get_model(controller, model_name)
             model = await self.get_model(controller, model_name)
+            self.log.debug(f"Destroying manual machines in model {model_name}")
             # Destroy machines that are manually provisioned
             # and still are in pending state
             await self._destroy_pending_machines(model, only_manual=True)
             # Destroy machines that are manually provisioned
             # and still are in pending state
             await self._destroy_pending_machines(model, only_manual=True)
@@ -1343,7 +1344,11 @@ class Libjuju:
             )
         except Exception as e:
             if not await self.model_exists(model_name, controller=controller):
             )
         except Exception as e:
             if not await self.model_exists(model_name, controller=controller):
+                self.log.warn(
+                    f"Failed deleting model {model_name}: model doesn't exist"
+                )
                 return
                 return
+            self.log.warn(f"Failed deleting model {model_name}: {e}")
             raise e
         finally:
             if model:
             raise e
         finally:
             if model:
@@ -1360,6 +1365,7 @@ class Libjuju:
         :param: controller: Controller object
         :param: timeout: Timeout in seconds
         """
         :param: controller: Controller object
         :param: timeout: Timeout in seconds
         """
+        self.log.debug(f"Destroying model {model_name}")
 
         async def _destroy_model_loop(model_name: str, controller: Controller):
             while await self.model_exists(model_name, controller=controller):
 
         async def _destroy_model_loop(model_name: str, controller: Controller):
             while await self.model_exists(model_name, controller=controller):
index 261b4b8..b2ffa0a 100644 (file)
@@ -829,6 +829,7 @@ class N2VCJujuConnector(N2VCConnector):
                                 model_name=model, total_timeout=total_timeout
                             )
                     except Exception as e:
                                 model_name=model, total_timeout=total_timeout
                             )
                     except Exception as e:
+                        self.log.error(f"Error deleting namespace {namespace} : {e}")
                         raise N2VCException(
                             message="Error deleting namespace {} : {}".format(
                                 namespace, e
                         raise N2VCException(
                             message="Error deleting namespace {} : {}".format(
                                 namespace, e
@@ -839,6 +840,9 @@ class N2VCJujuConnector(N2VCConnector):
                         message="only ns_id is permitted to delete yet",
                         bad_args=["namespace"],
                     )
                         message="only ns_id is permitted to delete yet",
                         bad_args=["namespace"],
                     )
+        except Exception as e:
+            self.log.error(f"Error deleting namespace {namespace} : {e}")
+            raise e
         finally:
             self.delete_namespace_locks.pop(namespace)
         self.log.info("Namespace {} deleted".format(namespace))
         finally:
             self.delete_namespace_locks.pop(namespace)
         self.log.info("Namespace {} deleted".format(namespace))