Remove EntityType from juju watcher and workaround juju bug for retrieving the status
[osm/N2VC.git] / n2vc / libjuju.py
index c62b11c..e73e552 100644 (file)
@@ -242,7 +242,9 @@ class Libjuju:
         """
         if not model_names:
             raise Exception(
-                "model_names must be a non-empty array. Given value: {}".format(model_names)
+                "model_names must be a non-empty array. Given value: {}".format(
+                    model_names
+                )
             )
         non_existing_models = []
         models = await self.list_models()
@@ -624,7 +626,9 @@ class Libjuju:
                 if await u.is_leader_from_status():
                     unit = u
             if unit is None:
-                raise JujuLeaderUnitNotFound("Cannot execute action: leader unit not found")
+                raise JujuLeaderUnitNotFound(
+                    "Cannot execute action: leader unit not found"
+                )
 
             actions = await application.get_actions()
 
@@ -703,10 +707,7 @@ class Libjuju:
             await self.disconnect_controller(controller)
 
     async def add_relation(
-        self,
-        model_name: str,
-        endpoint_1: str,
-        endpoint_2: str,
+        self, model_name: str, endpoint_1: str, endpoint_2: str,
     ):
         """Add relation
 
@@ -863,9 +864,7 @@ class Libjuju:
             # wait for machine removal
             machines = await model.get_machines()
             while machine_id in machines and time.time() < end:
-                self.log.debug(
-                    "Waiting for machine {} is destroyed".format(machine_id)
-                )
+                self.log.debug("Waiting for machine {} is destroyed".format(machine_id))
                 await asyncio.sleep(0.5)
                 machines = await model.get_machines()
             self.log.debug("Machine destroyed: {}".format(machine_id))