Fix bug 1722: add support for deploying .charm files
[osm/N2VC.git] / n2vc / libjuju.py
index 7a29a16..6580067 100644 (file)
@@ -558,7 +558,7 @@ class Libjuju:
         controller = await self.get_controller()
         model = await self.get_model(controller, model_name)
         try:
-            await model.deploy(uri)
+            await model.deploy(uri, trust=True)
             if wait:
                 await JujuModelWatcher.wait_for_model(model, timeout=timeout)
                 self.log.debug("All units active in model {}".format(model_name))
@@ -642,7 +642,6 @@ class Libjuju:
         :param: application_name:   Application name
         :param: model_name:         Model name
         :param: machine_id          Machine id
-        :param: db_dict:            Dictionary with data of the DB to write the updates
         :param: total_timeout:      Timeout for the entity to be active
 
         :return: None
@@ -792,6 +791,13 @@ class Libjuju:
                 raise JujuApplicationExists(
                     "Application {} exists".format(application_name)
                 )
+        except juju.errors.JujuError as e:
+            if "already exists" in e.message:
+                raise JujuApplicationExists(
+                    "Application {} exists".format(application_name)
+                )
+            else:
+                raise e
         finally:
             await self.disconnect_model(model)
             await self.disconnect_controller(controller)