From: Adam Israel Date: Tue, 10 Oct 2017 23:01:03 +0000 (-0400) Subject: Fix juju/tasklet integration X-Git-Tag: v3.0.0rc14~15 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FSO.git;a=commitdiff_plain;h=979dcfbc15ad4ecd3d8cd41436493361966db08f Fix juju/tasklet integration This fixes a few minor papercuts in the rwconmantasklet that prevented charms from being deployed. Signed-off-by: Adam Israel --- diff --git a/common/python/rift/mano/config_agent/operdata.py b/common/python/rift/mano/config_agent/operdata.py index 49f5b03b..94e99764 100644 --- a/common/python/rift/mano/config_agent/operdata.py +++ b/common/python/rift/mano/config_agent/operdata.py @@ -69,8 +69,12 @@ class JujuClient(object): loop=loop, )) except Exception as e: + loop.close() + msg = "JujuClient: Connection Failed: %s", str(e) self._log.error(msg) + status = "failure" + details = msg raise Exception(msg) else: self._log.error("Success reached.") diff --git a/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/jujuconf.py b/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/jujuconf.py index 2691ec53..0b7ecae9 100644 --- a/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/jujuconf.py +++ b/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/jujuconf.py @@ -25,8 +25,9 @@ import rift.mano.utils.juju_api as juju from . import riftcm_config_plugin -# Charm service name accepts only a to z and -. def get_vnf_unique_name(nsr_name, vnfr_name, member_vnf_index): + """Get the unique VNF name. + Charm names accepts only a to z and non-consecutive - characters.""" name = "{}-{}-{}".format(nsr_name, vnfr_name, member_vnf_index) new_name = '' for c in name: @@ -35,7 +36,7 @@ def get_vnf_unique_name(nsr_name, vnfr_name, member_vnf_index): elif not c.isalpha(): c = "-" new_name += c - return new_name.lower() + return re.sub('\-+', '-', new_name.lower()) class JujuConfigPlugin(riftcm_config_plugin.RiftCMConfigPluginBase): @@ -185,12 +186,11 @@ class JujuConfigPlugin(riftcm_config_plugin.RiftCMConfigPluginBase): 'launchpad/packages/vnfd', self._project.name, agent_vnfr.vnfr_msg.vnfd.id, - 'charms/trusty', + 'charms', 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)) + self._log.error("jujuCA: Did not find the charm directory at {}".format(path)) path = None except Exception as e: self.log.exception(e) @@ -559,6 +559,7 @@ class JujuConfigPlugin(riftcm_config_plugin.RiftCMConfigPluginBase): try: vnfr = self._juju_vnfs[agent_vnfr.id].vnfr + service = vnfr['vnf_juju_name'] except KeyError: self._log.debug("Did not find VNFR %s in Juju plugin", agent_vnfr.name) @@ -618,9 +619,6 @@ class JujuConfigPlugin(riftcm_config_plugin.RiftCMConfigPluginBase): self._log.error(msg) return False - elif rc == "pending": - action_ids.append(eid) - elif primitive.name: config = {} if primitive.name == 'config':