Commit 0a901fd8 authored by Spiros Koulouzis's avatar Spiros Koulouzis

fixed deplyer json parsing bug

parent bd6c5399
...@@ -643,7 +643,7 @@ public class DeployService { ...@@ -643,7 +643,7 @@ public class DeployService {
Map<String, Object> info = new HashMap(); Map<String, Object> info = new HashMap();
for (MessageParameter param : params) { for (MessageParameter param : params) {
String jsonResp = param.getValue().replaceAll("^\"|\"$", ""); String jsonResp = param.getValue().replaceAll("^\"|\"$", "");
System.err.println(jsonResp); // System.err.println(jsonResp);
Map<String, Object> kv = Converter.jsonString2Map(jsonResp); Map<String, Object> kv = Converter.jsonString2Map(jsonResp);
info.putAll(kv); info.putAll(kv);
......
...@@ -56,7 +56,7 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl ...@@ -56,7 +56,7 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
* @author S. Koulouzis * @author S. Koulouzis
*/ */
@Controller @Controller
@RequestMapping("/user/v1.0/?wadl") @RequestMapping("/user/v1.0/")
public class WADLController { public class WADLController {
String xs_namespace = "http://www.w3.org/2001/XMLSchema"; String xs_namespace = "http://www.w3.org/2001/XMLSchema";
...@@ -67,6 +67,7 @@ public class WADLController { ...@@ -67,6 +67,7 @@ public class WADLController {
@RequestMapping(method = RequestMethod.GET, @RequestMapping(method = RequestMethod.GET,
// consumes = MediaType.APPLICATION_XML_VALUE, // consumes = MediaType.APPLICATION_XML_VALUE,
produces = MediaType.APPLICATION_XML_VALUE) produces = MediaType.APPLICATION_XML_VALUE)
public @ResponseBody public @ResponseBody
Application generateWadl(HttpServletRequest request) { Application generateWadl(HttpServletRequest request) {
......
...@@ -74,6 +74,7 @@ def docker_check(vm, compose_name): ...@@ -74,6 +74,7 @@ def docker_check(vm, compose_name):
cmd = 'sudo docker stack ps '+ compose_name +' --format ' + services_format cmd = 'sudo docker stack ps '+ compose_name +' --format ' + services_format
logger.info("Sending :"+cmd) logger.info("Sending :"+cmd)
stdin, stdout, stderr = ssh.exec_command(cmd) stdin, stdout, stderr = ssh.exec_command(cmd)
stack_ps_resp = stdout.readlines() stack_ps_resp = stdout.readlines()
services_info = [] services_info = []
...@@ -90,6 +91,8 @@ def docker_check(vm, compose_name): ...@@ -90,6 +91,8 @@ def docker_check(vm, compose_name):
json_dict = json.loads(json_dict) json_dict = json.loads(json_dict)
except Exception as e: except Exception as e:
json_dict = json_dict.replace('\"ports\":\"\"', '\"ports\":null').replace('\"\"', '\"') json_dict = json_dict.replace('\"ports\":\"\"', '\"ports\":null').replace('\"\"', '\"')
json_dict = json_dict.replace('\"node\":\",\"', '\"node\":null,\"').replace('\"\"', '\"')
json_dict = json_dict.replace("\\", "").replace("Noxe2x80xa6", "No...") json_dict = json_dict.replace("\\", "").replace("Noxe2x80xa6", "No...")
json_dict = json.loads(json_dict) json_dict = json.loads(json_dict)
nodes_hostname.add(json_dict['node']) nodes_hostname.add(json_dict['node'])
...@@ -116,7 +119,8 @@ def docker_check(vm, compose_name): ...@@ -116,7 +119,8 @@ def docker_check(vm, compose_name):
cmd = 'sudo docker node inspect ' cmd = 'sudo docker node inspect '
for hostname in nodes_hostname: for hostname in nodes_hostname:
cmd += ' '+hostname if hostname:
cmd += ' '+hostname
logger.info("Sending :"+cmd) logger.info("Sending :"+cmd)
stdin, stdout, stderr = ssh.exec_command(cmd) stdin, stdout, stderr = ssh.exec_command(cmd)
inspect_resp = stdout.readlines() inspect_resp = stdout.readlines()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment