diff options
Diffstat (limited to 'appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/impl')
-rw-r--r-- | appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/impl/AnsibleAdapterImpl.java | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/impl/AnsibleAdapterImpl.java b/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/impl/AnsibleAdapterImpl.java index 36d486375..b9cdbc6bb 100644 --- a/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/impl/AnsibleAdapterImpl.java +++ b/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/impl/AnsibleAdapterImpl.java @@ -25,6 +25,7 @@ package org.onap.appc.adapter.ansible.impl; import java.util.Map; import java.util.Properties; + import org.apache.commons.lang.StringUtils; import org.json.JSONException; import org.json.JSONObject; @@ -38,9 +39,9 @@ import org.onap.appc.configuration.ConfigurationFactory; import org.onap.appc.exceptions.APPCException; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; + import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; -import org.onap.appc.encryption.EncryptionTool; /** * This class implements the {@link AnsibleAdapter} interface. This interface defines the behaviors @@ -76,7 +77,6 @@ public class AnsibleAdapterImpl implements AnsibleAdapter { private static final String RESULT_CODE_ATTRIBUTE_NAME = "org.onap.appc.adapter.ansible.result.code"; private static final String MESSAGE_ATTRIBUTE_NAME = "org.onap.appc.adapter.ansible.message"; private static final String RESULTS_ATTRIBUTE_NAME = "org.onap.appc.adapter.ansible.results"; - private static final String OUTPUT_ATTRIBUTE_NAME = "org.onap.appc.adapter.ansible.output"; private static final String ID_ATTRIBUTE_NAME = "org.onap.appc.adapter.ansible.Id"; private static final String LOG_ATTRIBUTE_NAME = "org.onap.appc.adapter.ansible.log"; @@ -226,7 +226,7 @@ public class AnsibleAdapterImpl implements AnsibleAdapter { agentUrl = (String) jsonPayload.remove("AgentUrl"); user = (String) jsonPayload.remove("User"); - password = EncryptionTool.getInstance().decrypt((String) jsonPayload.remove(PASSWORD)); + password = (String) jsonPayload.remove(PASSWORD); id = jsonPayload.getString("Id"); payload = jsonPayload.toString(); logger.info("Updated Payload = " + payload); @@ -317,23 +317,20 @@ public class AnsibleAdapterImpl implements AnsibleAdapter { int code = -1; String message = StringUtils.EMPTY; String results = StringUtils.EMPTY; - String output = StringUtils.EMPTY; try { // Try to retrieve the test results (modify the URL for that) - AnsibleResult testResult = queryServer(reqUri, params.get("User"), EncryptionTool.getInstance().decrypt(params.get(PASSWORD))); + AnsibleResult testResult = queryServer(reqUri, params.get("User"), params.get(PASSWORD)); code = testResult.getStatusCode(); message = testResult.getStatusMessage(); - if (code == 200 || code == 400) { + if (code == 200) { logger.info("Parsing response from Server = " + message); // Valid HTTP. process the Ansible message testResult = messageProcessor.parseGetResponse(message); code = testResult.getStatusCode(); message = testResult.getStatusMessage(); results = testResult.getResults(); - output = testResult.getOutput(); - } logger.info("Request response = " + message); @@ -357,10 +354,9 @@ public class AnsibleAdapterImpl implements AnsibleAdapter { return; } - ctx.setAttribute(RESULT_CODE_ATTRIBUTE_NAME, Integer.toString(400)); + ctx.setAttribute(RESULT_CODE_ATTRIBUTE_NAME, Integer.toString(code)); ctx.setAttribute(MESSAGE_ATTRIBUTE_NAME, message); ctx.setAttribute(RESULTS_ATTRIBUTE_NAME, results); - ctx.setAttribute(OUTPUT_ATTRIBUTE_NAME, output); ctx.setStatus(OUTCOME_SUCCESS); } @@ -385,7 +381,7 @@ public class AnsibleAdapterImpl implements AnsibleAdapter { String message = StringUtils.EMPTY; try { // Try to retrieve the test results (modify the url for that) - AnsibleResult testResult = queryServer(reqUri, params.get("User"), EncryptionTool.getInstance().decrypt(params.get(PASSWORD))); + AnsibleResult testResult = queryServer(reqUri, params.get("User"), params.get(PASSWORD)); message = testResult.getStatusMessage(); logger.info("Request output = " + message); ctx.setAttribute(LOG_ATTRIBUTE_NAME, message); |