X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=rwcm%2Fplugins%2Frwconman%2Frift%2Ftasklets%2Frwconmantasklet%2Fjujuconf.py;h=b003df8da86707b8cf163e237413ecd702e40696;hb=07c745714bdf2a2c1e69001cf4faf6a83cecc293;hp=33aeed6ceb8ddb6c9547871eb5b6787a7a24a4cd;hpb=f27e0990e25d51b8a697b9518eefaa850a4be371;p=osm%2FSO.git diff --git a/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/jujuconf.py b/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/jujuconf.py index 33aeed6c..b003df8d 100644 --- a/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/jujuconf.py +++ b/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/jujuconf.py @@ -190,8 +190,11 @@ class JujuConfigPlugin(riftcm_config_plugin.RiftCMConfigPluginBase): charm) self._log.debug("jujuCA: Charm dir is {}".format(path)) if not os.path.isdir(path): - self._log.error("jujuCA: Did not find the charm directory at {}".format(path)) + msg = "jujuCA: Did not find the charm directory at {}".format(path) + self._log.error(msg) path = None + # Return from here instead of forwarding the config request to juju_api + raise Exception(msg) except Exception as e: self.log.exception(e) return False @@ -199,12 +202,13 @@ class JujuConfigPlugin(riftcm_config_plugin.RiftCMConfigPluginBase): if vnf_unique_name not in self._tasks: self._tasks[vnf_unique_name] = {} - self._tasks[vnf_unique_name]['deploy'] = self.loop.create_task( - self.api.deploy_application(charm, vnf_unique_name, path=path)) - self._log.debug("jujuCA: Deploying service %s", vnf_unique_name) - + yield from self.api.deploy_application( + charm, + vnf_unique_name, + path=path, + ) return True @asyncio.coroutine @@ -239,15 +243,15 @@ class JujuConfigPlugin(riftcm_config_plugin.RiftCMConfigPluginBase): vnfr = agent_vnfr.vnfr service = vnfr['vnf_juju_name'] - self._log.debug ("jujuCA: Terminating VNFr %s, %s", - agent_vnfr.name, service) - self._tasks[service]['destroy'] = self.loop.create_task( - self.api.remove_application(service) - ) + self._log.debug("jujuCA: Terminating VNFr {}, {}".format( + agent_vnfr.name, + service, + )) + yield from self.api.remove_application(service) del self._juju_vnfs[agent_vnfr.id] - self._log.debug ("jujuCA: current vnfrs={}". - format(self._juju_vnfs)) + self._log.debug("jujuCA: current vnfrs={}". + format(self._juju_vnfs)) if service in self._tasks: tasks = [] for action in self._tasks[service].keys():