X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=n2vc%2Fk8s_juju_conn.py;h=f8ed0e0155cca930d744fdb677e943f0c0011fe7;hb=HEAD;hp=eabc6193573b959b54f105ef2cdcd6c92651f586;hpb=085942e581b846f59ac6cb94b0e6ff72663d86e2;p=osm%2FN2VC.git diff --git a/n2vc/k8s_juju_conn.py b/n2vc/k8s_juju_conn.py index eabc619..c197221 100644 --- a/n2vc/k8s_juju_conn.py +++ b/n2vc/k8s_juju_conn.py @@ -51,7 +51,6 @@ class K8sJujuConnector(K8sConnector): kubectl_command: str = "/usr/bin/kubectl", juju_command: str = "/usr/bin/juju", log: object = None, - loop: object = None, on_update_db=None, ): """ @@ -60,19 +59,17 @@ class K8sJujuConnector(K8sConnector): :param kubectl_command: path to kubectl executable :param helm_command: path to helm executable :param log: logger - :param: loop: Asyncio loop """ # parent class K8sConnector.__init__(self, db, log=log, on_update_db=on_update_db) self.fs = fs - self.loop = loop or asyncio.get_event_loop() self.log.debug("Initializing K8S Juju connector") db_uri = EnvironConfig(prefixes=["OSMLCM_", "OSMMON_"]).get("database_uri") self._store = MotorStore(db_uri) - self.loading_libjuju = asyncio.Lock(loop=self.loop) + self.loading_libjuju = asyncio.Lock() self.uninstall_locks = {} self.log.debug("K8S Juju connector initialized") @@ -330,7 +327,14 @@ class K8sJujuConnector(K8sConnector): previous_workdir = "/app/storage" self.log.debug("[install] deploying {}".format(bundle)) - await libjuju.deploy(bundle, model_name=namespace, wait=atomic, timeout=timeout) + instantiation_params = params.get("overlay") if params else None + await libjuju.deploy( + bundle, + model_name=namespace, + wait=atomic, + timeout=timeout, + instantiation_params=instantiation_params, + ) os.chdir(previous_workdir) # update information in the database (first, the VCA status, and then, the namespace) @@ -502,7 +506,7 @@ class K8sJujuConnector(K8sConnector): will_not_delete = False if model_name not in self.uninstall_locks: - self.uninstall_locks[model_name] = asyncio.Lock(loop=self.loop) + self.uninstall_locks[model_name] = asyncio.Lock() delete_lock = self.uninstall_locks[model_name] while delete_lock.locked(): @@ -908,11 +912,11 @@ class K8sJujuConnector(K8sConnector): if not self.libjuju: async with self.loading_libjuju: vca_connection = await get_connection(self._store) - self.libjuju = Libjuju(vca_connection, loop=self.loop, log=self.log) + self.libjuju = Libjuju(vca_connection, log=self.log) return self.libjuju else: vca_connection = await get_connection(self._store, vca_id) - return Libjuju(vca_connection, loop=self.loop, log=self.log, n2vc=self) + return Libjuju(vca_connection, log=self.log, n2vc=self) def _get_kubectl(self, credentials: str) -> Kubectl: """