projects
/
osm
/
N2VC.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Minor improvements to libjuju.py
[osm/N2VC.git]
/
n2vc
/
libjuju.py
diff --git
a/n2vc/libjuju.py
b/n2vc/libjuju.py
index
a79d00d
..
bf356f4
100644
(file)
--- a/
n2vc/libjuju.py
+++ b/
n2vc/libjuju.py
@@
-117,7
+117,7
@@
class Libjuju:
def _create_health_check_task(self):
return self.loop.create_task(self.health_check())
def _create_health_check_task(self):
return self.loop.create_task(self.health_check())
- async def get_controller(self, timeout: float = 5.0) -> Controller:
+ async def get_controller(self, timeout: float =
1
5.0) -> Controller:
"""
Get controller
"""
Get controller
@@
-853,8
+853,9
@@
class Libjuju:
"""
controller = await self.get_controller()
"""
controller = await self.get_controller()
- model =
await self.get_model(controller, model_name)
+ model =
None
try:
try:
+ model = await self.get_model(controller, model_name)
self.log.debug("Destroying model {}".format(model_name))
uuid = model.info.uuid
self.log.debug("Destroying model {}".format(model_name))
uuid = model.info.uuid
@@
-888,6
+889,10
@@
class Libjuju:
raise Exception(
"Timeout waiting for model {} to be destroyed".format(model_name)
)
raise Exception(
"Timeout waiting for model {} to be destroyed".format(model_name)
)
+ except Exception as e:
+ if model:
+ await self.disconnect_model(model)
+ raise e
finally:
await self.disconnect_controller(controller)
finally:
await self.disconnect_controller(controller)