aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJegadeesh Babu <jegabab1@in.ibm.com>2019-03-18 19:24:07 +0530
committerJegadeesh Babu <jegabab1@in.ibm.com>2019-03-18 19:25:05 +0530
commit0ce69b05291999c4bbf297ee0481ec8e991eebfd (patch)
treeb122cd0df2942af948480261bb41bcacf4b38965
parent65fcc85ae6cb8fe2abcd782f4b7006f80a941126 (diff)
Replaced hardcoded with const variable
Sonar fix Issue-ID: APPC-1544 Change-Id: I19c7f33d4e7d1070fa84a33e4f997923c9c1f8e1 Signed-off-by: Jegadeesh Babu <jegabab1@in.ibm.com>
-rw-r--r--appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/main/java/org/onap/appc/adapter/ansible/impl/AnsibleAdapterImpl.java9
1 files changed, 5 insertions, 4 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 b352dbebc..971730eba 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
@@ -93,6 +93,7 @@ public class AnsibleAdapterImpl implements AnsibleAdapter {
private static final String APPC_PROPS = "/appc.properties";
private static final String SDNC_CONFIG_DIR = "SDNC_CONFIG_DIR";
private static final String propDir = System.getenv(SDNC_CONFIG_DIR);
+ private static final String SERVERIP = "ServerIP";
private Properties props;
private int defaultTimeout = 600 * 1000;
private int defaultSocketTimeout = 60 * 1000;
@@ -335,9 +336,9 @@ public class AnsibleAdapterImpl implements AnsibleAdapter {
ctx.setAttribute(OUTPUT_ATTRIBUTE_NAME, output);
String serverIp = testResult.getServerIp();
if (StringUtils.isBlank(serverIp))
- ctx.setAttribute("ServerIP", serverIp);
+ ctx.setAttribute(SERVERIP, serverIp);
else
- ctx.setAttribute("ServerIP", "");
+ ctx.setAttribute(SERVERIP, "");
// Check status of test request returned by Agent
if (code == AnsibleResultCodes.PENDING.getValue()) {
logger.info(String.format("Submission of Test %s successful.", playbookName));
@@ -373,7 +374,7 @@ public class AnsibleAdapterImpl implements AnsibleAdapter {
String reqUri = StringUtils.EMPTY;
try {
- String serverIp = ctx.getAttribute("ServerIP");
+ String serverIp = ctx.getAttribute(SERVERIP);
if (StringUtils.isNotBlank(serverIp))
reqUri = messageProcessor.reqUriResultWithIP(params, serverIp);
else
@@ -515,7 +516,7 @@ public class AnsibleAdapterImpl implements AnsibleAdapter {
long endTime = System.currentTimeMillis() + timeout;
while (System.currentTimeMillis() < endTime) {
- String serverIP = ctx.getAttribute("ServerIP");
+ String serverIP = ctx.getAttribute(SERVERIP);
ConnectionBuilder httpClientLocal = getHttpConn(defaultSocketTimeout, serverIP);
logger.info("Querying ansible GetResult URL = " + agentUrl);