summaryrefslogtreecommitdiffstats
path: root/holmes-actions/src/main
diff options
context:
space:
mode:
authorGuangrong Fu <fu.guangrong@zte.com.cn>2017-10-30 15:01:53 +0800
committerGuangrong Fu <fu.guangrong@zte.com.cn>2017-10-30 15:01:53 +0800
commit3dfe506a8ea1bec7096da63541e426958d04a1a0 (patch)
tree9b644cf858c5b41a44781e4820c0d8bf7ca8da27 /holmes-actions/src/main
parent2e3aee44bf7a25aa665c3e6bd1130209ace50193 (diff)
Update the logic for MSB addr retrieving
Change-Id: Id4258d763489f622f68c8152bb89e093993d1982 Issue-ID: HOLMES-81 Signed-off-by: Guangrong Fu <fu.guangrong@zte.com.cn>
Diffstat (limited to 'holmes-actions/src/main')
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/config/MicroServiceConfig.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/config/MicroServiceConfig.java b/holmes-actions/src/main/java/org/onap/holmes/common/config/MicroServiceConfig.java
index 01a5f2e..212bc66 100644
--- a/holmes-actions/src/main/java/org/onap/holmes/common/config/MicroServiceConfig.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/config/MicroServiceConfig.java
@@ -49,6 +49,7 @@ public class MicroServiceConfig {
public static String getConfigBindingServiceAddrInfo() {
String ret = null;
String queryString = getConsulAddrInfo() + CONFIG_BINDING_SERVICE;
+ log.info("Query the CBS address using the URL: " + queryString);
try {
JSONObject addrJson = (JSONObject) JSONArray.fromObject(execQuery(queryString)).get(0);
if (addrJson.has("ServiceAddress") && addrJson.has("ServicePort")) {
@@ -57,6 +58,7 @@ public class MicroServiceConfig {
} catch (Exception e) {
log.warn(e.getMessage(), e);
}
+ log.info("The CBS address is " + ret);
return ret;
}
@@ -71,6 +73,7 @@ public class MicroServiceConfig {
String url = getConfigBindingServiceAddrInfo() + "/service_component/" +serviceName;
try {
JSONObject jsonObject = JSONObject.fromObject(execQuery(url));
+ log.info("The origin configurations (" + url + ") returned by DCAE is: " + jsonObject.toString());
if (jsonObject.has(serviceName)) {
ret = (String) jsonObject.getJSONArray(serviceName).get(0);
}
@@ -92,7 +95,11 @@ public class MicroServiceConfig {
public static String[] getMsbAddrInfo() {
String[] msbServerInfo = null;
- String info = getServiceAddrInfoFromCBS(MSB_ADDR);
+ //String info = getServiceAddrInfoFromCBS(MSB_ADDR);
+ String info = getServiceAddrInfoFromCBS(getEnv(HOSTNAME));
+ log.info("Got the service information of \"" + getEnv(HOSTNAME) + "\" from CBS. The response is " + info + ".");
+ JSONObject infoObj = JSONObject.fromObject(info);
+ info = infoObj.has("msb.hostname") ? infoObj.getString("msb.hostname") : null;
if (info != null){
msbServerInfo = split(info);
} else {
@@ -105,6 +112,7 @@ public class MicroServiceConfig {
public static String[] getServiceAddrInfo() {
String[] serviceAddrInfo = null;
String info = getServiceAddrInfoFromCBS(getEnv(HOSTNAME));
+ log.info("Got the service information of \"" + getEnv(HOSTNAME) + "\" from CBS. The response is " + info + ".");
if (info != null){
serviceAddrInfo = split(info);
} else {