projects
/
osm
/
N2VC.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bug 2054 fixed: raising JujuControllerFailedConnecting with error message
[osm/N2VC.git]
/
n2vc
/
libjuju.py
diff --git
a/n2vc/libjuju.py
b/n2vc/libjuju.py
index
a903860
..
5ed1d67
100644
(file)
--- a/
n2vc/libjuju.py
+++ b/
n2vc/libjuju.py
@@
-95,7
+95,7
@@
class Libjuju:
"""
controller = None
try:
"""
controller = None
try:
- controller = Controller(
loop=self.loop
)
+ controller = Controller()
await asyncio.wait_for(
controller.connect(
endpoint=self.vca_connection.data.endpoints,
await asyncio.wait_for(
controller.connect(
endpoint=self.vca_connection.data.endpoints,
@@
-122,7
+122,10
@@
class Libjuju:
)
if controller:
await self.disconnect_controller(controller)
)
if controller:
await self.disconnect_controller(controller)
- raise JujuControllerFailedConnecting(e)
+
+ raise JujuControllerFailedConnecting(
+ f"Error connecting to Juju controller: {e}"
+ )
async def disconnect(self):
"""Disconnect"""
async def disconnect(self):
"""Disconnect"""
@@
-1223,6
+1226,10
@@
class Libjuju:
controller,
timeout=total_timeout,
)
controller,
timeout=total_timeout,
)
+ except Exception as e:
+ if not await self.model_exists(model_name, controller=controller):
+ return
+ raise e
finally:
if model:
await self.disconnect_model(model)
finally:
if model:
await self.disconnect_model(model)
@@
-1254,6
+1261,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 juju.errors.JujuError as e:
+ if any("has been removed" in error for error in e.errors):
+ return
+ raise e
async def destroy_application(
self, model_name: str, application_name: str, total_timeout: float
async def destroy_application(
self, model_name: str, application_name: str, total_timeout: float