Bug 412 - Fixed an unitialized vnfr access in vnf config primitive
[osm/SO.git] / rwcm / plugins / rwconman / rift / tasklets / rwconmantasklet / jujuconf.py
index 7688dae..6cf549a 100644 (file)
@@ -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
@@ -288,6 +291,7 @@ class JujuConfigPlugin(riftcm_config_plugin.RiftCMConfigPluginBase):
         self._log.debug("VNF config= %s", vnf_config.as_dict())
 
         try:
+            vnfr = self._juju_vnfs[vnfr_id].vnfr
             service = vnfr['vnf_juju_name']
             self._log.debug("VNF config %s", vnf_config)
             configs = vnf_config.config_primitive
@@ -416,7 +420,7 @@ class JujuConfigPlugin(riftcm_config_plugin.RiftCMConfigPluginBase):
             primitive)
 
         self._log.debug("VNFR {} primitive {} exec status: {}".
-                        format(vnfr.name, primitive.name, rc))
+                        format(vnfr_id, primitive.name, rc))
         output.execution_status = rc
         output.execution_id = exec_id
         output.execution_error_details = err