diff options
author | 2019-02-21 15:19:07 +0000 | |
---|---|---|
committer | 2019-04-10 12:54:57 +0000 | |
commit | c8c612b74cf3599d36b66db4ef33302b45f3ff54 (patch) | |
tree | 5b14b457d54cbe61f0e0618d756579b4c445ee49 /appc-config/appc-config-generator/provider/src/main/java/org | |
parent | b45d4528f2c563cdff2e78837a4164deb4152283 (diff) |
Fix for Ansible Healthcheck bug
Update to directed graph and merge JSON template code
Issue-ID: APPC-1472
Change-Id: I4332ad74d34f455261b1c001339d0542be4514fc
Signed-off-by: Joss Armstrong <joss.armstrong@ericsson.com>
Diffstat (limited to 'appc-config/appc-config-generator/provider/src/main/java/org')
-rw-r--r-- | appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/merge/MergeNode.java | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/merge/MergeNode.java b/appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/merge/MergeNode.java index e8c530486..908965ca7 100644 --- a/appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/merge/MergeNode.java +++ b/appc-config/appc-config-generator/provider/src/main/java/org/onap/sdnc/config/generator/merge/MergeNode.java @@ -53,23 +53,23 @@ public class MergeNode implements SvcLogicJavaPlugin { responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix + ".") : ""; String jsonData = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_JSON_DATA); if (StringUtils.isBlank(jsonData)) { - throw new ParameterMissingException("JSON Data is missing"); - } - - String templateData = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_DATA); - String templateFile = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_FILE); - - if (StringUtils.isBlank(templateData) && StringUtils.isBlank(templateFile)) { - throw new ParameterMissingException("Template data or Template file is missing"); - } - if (StringUtils.isBlank(templateData)) { - templateData = IOUtils.toString( - MergeNode.class.getClassLoader().getResourceAsStream(templateFile), "UTF-8"); + log.info("No JSON data to merge with template"); + } else { + String templateData = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_DATA); + String templateFile = inParams.get(ConfigGeneratorConstant.INPUT_PARAM_TEMPLATE_FILE); + + if (StringUtils.isBlank(templateData) && StringUtils.isBlank(templateFile)) { + throw new ParameterMissingException("Template data or Template file is missing"); + } + if (StringUtils.isBlank(templateData)) { + templateData = IOUtils.toString( + MergeNode.class.getClassLoader().getResourceAsStream(templateFile), "UTF-8"); + } + + Map<String, String> dataMap = JSONTool.convertToProperties(jsonData); + log.info("Data Maps created :" + dataMap); + trySetContextAttribute(ctx, responsePrefix, templateData, dataMap); } - - Map<String, String> dataMap = JSONTool.convertToProperties(jsonData); - log.info("Data Maps created :" + dataMap); - trySetContextAttribute(ctx, responsePrefix, templateData, dataMap); ctx.setAttribute(responsePrefix + ConfigGeneratorConstant.OUTPUT_PARAM_STATUS, ConfigGeneratorConstant.OUTPUT_STATUS_SUCCESS); log.info("Data Merge Successful :" + ctx); |