projects
/
osm
/
N2VC.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix bug 1529: Give warning when removing unexisting chart
[osm/N2VC.git]
/
n2vc
/
libjuju.py
diff --git
a/n2vc/libjuju.py
b/n2vc/libjuju.py
index
dd37ec8
..
5c803ed
100644
(file)
--- a/
n2vc/libjuju.py
+++ b/
n2vc/libjuju.py
@@
-17,7
+17,7
@@
import logging
import time
import time
-from juju.errors import JujuAPIError
+import juju.errors
from juju.model import Model
from juju.machine import Machine
from juju.application import Application
from juju.model import Model
from juju.machine import Machine
from juju.application import Application
@@
-620,7
+620,7
@@
class Libjuju:
db_dict: dict = None,
progress_timeout: float = None,
total_timeout: float = None,
db_dict: dict = None,
progress_timeout: float = None,
total_timeout: float = None,
- **kwargs
+ **kwargs
,
):
"""Execute action
):
"""Execute action
@@
-793,7
+793,7
@@
class Libjuju:
# Add relation
try:
await model.add_relation(endpoint_1, endpoint_2)
# Add relation
try:
await model.add_relation(endpoint_1, endpoint_2)
- except JujuAPIError as e:
+ except
juju.errors.
JujuAPIError as e:
if "not found" in e.message:
self.log.warning("Relation not found: {}".format(e.message))
return
if "not found" in e.message:
self.log.warning("Relation not found: {}".format(e.message))
return
@@
-1217,6
+1217,11
@@
class Libjuju:
controller = await self.get_controller()
try:
await controller.remove_cloud(name)
controller = await self.get_controller()
try:
await controller.remove_cloud(name)
+ except juju.errors.JujuError as e:
+ if len(e.errors) == 1 and f'cloud "{name}" not found' == e.errors[0]:
+ self.log.warning(f"Cloud {name} not found, so it could not be deleted.")
+ else:
+ raise e
finally:
await self.disconnect_controller(controller)
finally:
await self.disconnect_controller(controller)