From: Adam Israel Date: Thu, 5 Oct 2017 22:45:47 +0000 (-0400) Subject: Fix syntax/indent errors X-Git-Tag: v3.0.0^0 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=29bad82282830aa5e29e1927c752117a6bbb1df5;p=osm%2FSO.git Fix syntax/indent errors There was a bad block that I overlooked in the last commit that was uncovered when CI unblocked. This should fix stage_3 CI. Signed-off-by: Adam Israel --- diff --git a/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/jujuconf.py b/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/jujuconf.py index 5068b313..2691ec53 100644 --- a/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/jujuconf.py +++ b/rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/jujuconf.py @@ -587,7 +587,6 @@ class JujuConfigPlugin(riftcm_config_plugin.RiftCMConfigPluginBase): if not rc: return False - # action_ids = [] try: if vnfr_msg.mgmt_interface.ip_address: vnfr['tags'].update({'rw_mgmt_ip': vnfr_msg.mgmt_interface.ip_address}) @@ -630,57 +629,44 @@ class JujuConfigPlugin(riftcm_config_plugin.RiftCMConfigPluginBase): val = self.xlate(param.value, vnfr['tags']) config.update({param.name: val}) - except KeyError as e: - self._log.exception("jujuCA:(%s) Initial config error(%s): config=%s", - vnfr['vnf_juju_name'], str(e), config) - config = None - return False - - if config: - self.juju_log('info', vnfr['vnf_juju_name'], - "Applying Initial config:%s", - config) - - rc = yield from self.api.apply_config( - config, - application=service, - ) - if rc is False: - self.log.error("Service {} is in error state".format(service)) - return False if config: self.juju_log('info', vnfr['vnf_juju_name'], "Applying Initial config:%s", config) - # Apply any actions specified as part of initial config - for primitive in vnfr['config'].initial_config_primitive: - if primitive.name != 'config': - self._log.debug("jujuCA:(%s) Initial config action primitive %s", - vnfr['vnf_juju_name'], primitive) - action = primitive.name - params = {} - for param in primitive.parameter: - val = self.xlate(param.value, vnfr['tags']) - params.update({param.name: val}) - - self._log.info("jujuCA:(%s) Action %s with params %s", - vnfr['vnf_juju_name'], action, params) - self._log.debug("executing action") - resp = yield from self.api.execute_action( - service, - action, - **params, - ) - self._log.debug("executed action") - if 'error' in resp: - self._log.error("Applying initial config on {} failed for {} with {}: {}". - format(vnfr['vnf_juju_name'], action, params, resp)) - return False - - # action_ids.append(resp['action']['tag']) - # action_ids.append(resp) + rc = yield from self.api.apply_config( + config, + application=service, + ) + if rc is False: + self.log.error("Service {} is in error state".format(service)) + return False + else: + # Apply any actions specified as part of initial config + for primitive in vnfr['config'].initial_config_primitive: + if primitive.name != 'config': + self._log.debug("jujuCA:(%s) Initial config action primitive %s", + vnfr['vnf_juju_name'], primitive) + action = primitive.name + params = {} + for param in primitive.parameter: + val = self.xlate(param.value, vnfr['tags']) + params.update({param.name: val}) + + self._log.info("jujuCA:(%s) Action %s with params %s", + vnfr['vnf_juju_name'], action, params) + self._log.debug("executing action") + resp = yield from self.api.execute_action( + service, + action, + **params, + ) + self._log.debug("executed action") + if 'error' in resp: + self._log.error("Applying initial config on {} failed for {} with {}: {}". + format(vnfr['vnf_juju_name'], action, params, resp)) + return False except KeyError as e: self._log.info("Juju config agent(%s): VNFR %s not managed by Juju", vnfr['vnf_juju_name'], agent_vnfr.id)