Authored by zhouxiang

功能tag定义

@@ -43,7 +43,7 @@ public class LbSwitchCtrl { @@ -43,7 +43,7 @@ public class LbSwitchCtrl {
43 @ResponseBody 43 @ResponseBody
44 public BaseResponse viewConf() throws Exception { 44 public BaseResponse viewConf() throws Exception {
45 //直连的配置放在腾讯云nginx上 45 //直连的配置放在腾讯云nginx上
46 - List<HostInfo> qcloudNginxHosts = hostInfoMapper.selectHostInfosByTag("直连"); 46 + List<HostInfo> qcloudNginxHosts = hostInfoMapper.selectHostInfosByTag("lb-switch");
47 if (CollectionUtils.isEmpty(qcloudNginxHosts)) { 47 if (CollectionUtils.isEmpty(qcloudNginxHosts)) {
48 throw new Exception("没有找到直连nginx服务器"); 48 throw new Exception("没有找到直连nginx服务器");
49 } 49 }
@@ -79,7 +79,7 @@ public class LbSwitchCtrl { @@ -79,7 +79,7 @@ public class LbSwitchCtrl {
79 String path = request.getSession().getServletContext().getRealPath("/") + "lua/lb.lua"; 79 String path = request.getSession().getServletContext().getRealPath("/") + "lua/lb.lua";
80 logger.info("lb.lua template path {}", path); 80 logger.info("lb.lua template path {}", path);
81 //lua dns 只放在腾讯云nginx服务器上 81 //lua dns 只放在腾讯云nginx服务器上
82 - List<HostInfo> nginxHosts = hostInfoMapper.selectHostInfosByTag("直连"); 82 + List<HostInfo> nginxHosts = hostInfoMapper.selectHostInfosByTag("lb-switch");
83 if (CollectionUtils.isEmpty(nginxHosts)) { 83 if (CollectionUtils.isEmpty(nginxHosts)) {
84 return new BaseResponse(500, "在cmdb中未找到直连对应的nginx服务器!"); 84 return new BaseResponse(500, "在cmdb中未找到直连对应的nginx服务器!");
85 } 85 }
@@ -49,7 +49,7 @@ public class LuaSwitchCtrl { @@ -49,7 +49,7 @@ public class LuaSwitchCtrl {
49 @RequestMapping(value = "viewConf") 49 @RequestMapping(value = "viewConf")
50 @ResponseBody 50 @ResponseBody
51 public String viewConf() throws Exception { 51 public String viewConf() throws Exception {
52 - List<HostInfo> qcloudNginxHosts = hostInfoMapper.selectHostInfosByTagAndCloudType("nginx", 2); 52 + List<HostInfo> qcloudNginxHosts = hostInfoMapper.selectHostInfosByTag("lua-switch");
53 if (CollectionUtils.isEmpty(qcloudNginxHosts)) { 53 if (CollectionUtils.isEmpty(qcloudNginxHosts)) {
54 throw new Exception("没有找到nginx服务器"); 54 throw new Exception("没有找到nginx服务器");
55 } 55 }
@@ -83,7 +83,7 @@ public class LuaSwitchCtrl { @@ -83,7 +83,7 @@ public class LuaSwitchCtrl {
83 String path = request.getSession().getServletContext().getRealPath("/") + "lua/dns_resolver_worker.lua"; 83 String path = request.getSession().getServletContext().getRealPath("/") + "lua/dns_resolver_worker.lua";
84 logger.info("path {}", path); 84 logger.info("path {}", path);
85 //lua dns 只放在腾讯云nginx服务器上 85 //lua dns 只放在腾讯云nginx服务器上
86 - List<HostInfo> nginxHosts = hostInfoMapper.selectHostInfosByTagAndCloudType("nginx", 2); 86 + List<HostInfo> nginxHosts = hostInfoMapper.selectHostInfosByTag("lua-switch");
87 if (CollectionUtils.isEmpty(nginxHosts)) { 87 if (CollectionUtils.isEmpty(nginxHosts)) {
88 return new BaseResponse(500, "腾讯云在cmdb中未找到对应的nginx服务器!"); 88 return new BaseResponse(500, "腾讯云在cmdb中未找到对应的nginx服务器!");
89 } 89 }
@@ -44,7 +44,7 @@ public class NginxLimit { @@ -44,7 +44,7 @@ public class NginxLimit {
44 @RequestMapping(value = "viewConf") 44 @RequestMapping(value = "viewConf")
45 @ResponseBody 45 @ResponseBody
46 public BaseResponse viewConf() throws Exception { 46 public BaseResponse viewConf() throws Exception {
47 - List<HostInfo> qcloudNginxHosts = hostInfoMapper.selectHostInfosByTag("限流"); 47 + List<HostInfo> qcloudNginxHosts = hostInfoMapper.selectHostInfosByTag("limit-switch");
48 if (CollectionUtils.isEmpty(qcloudNginxHosts)) { 48 if (CollectionUtils.isEmpty(qcloudNginxHosts)) {
49 throw new Exception("没有找到限流nginx服务器"); 49 throw new Exception("没有找到限流nginx服务器");
50 } 50 }
@@ -95,7 +95,7 @@ public class NginxLimit { @@ -95,7 +95,7 @@ public class NginxLimit {
95 @ResponseBody 95 @ResponseBody
96 public BaseResponse switchNginxConf(HttpServletRequest httpRequest) { 96 public BaseResponse switchNginxConf(HttpServletRequest httpRequest) {
97 //获取对应cloud的机器 aws 1 qcloud 2 97 //获取对应cloud的机器 aws 1 qcloud 2
98 - List<HostInfo> nginxHosts = hostInfoMapper.selectHostInfosByTag("限流"); 98 + List<HostInfo> nginxHosts = hostInfoMapper.selectHostInfosByTag("limit-switch");
99 if (CollectionUtils.isEmpty(nginxHosts)) { 99 if (CollectionUtils.isEmpty(nginxHosts)) {
100 return new BaseResponse(500, "在cmdb中未找到限流对应的nginx服务器!"); 100 return new BaseResponse(500, "在cmdb中未找到限流对应的nginx服务器!");
101 } 101 }
@@ -65,14 +65,14 @@ public class NginxSwitchCtrl { @@ -65,14 +65,14 @@ public class NginxSwitchCtrl {
65 return new BaseResponse(map); 65 return new BaseResponse(map);
66 }*/ 66 }*/
67 67
68 - List<HostInfo> awsNginxHosts = hostInfoMapper.selectHostInfosByTagAndCloudType("nginx", 1); 68 + List<HostInfo> awsNginxHosts = hostInfoMapper.selectHostInfosByTagAndCloudType("upstream-switch", 1);
69 if(CollectionUtils.isEmpty(awsNginxHosts)){ 69 if(CollectionUtils.isEmpty(awsNginxHosts)){
70 map.put("awsList", Lists.newArrayList()); 70 map.put("awsList", Lists.newArrayList());
71 }else { 71 }else {
72 List<Map<String, Object>> awsList = analyseConfigFile(exe("view", awsNginxHosts.get(0).getHostIp(), null)); 72 List<Map<String, Object>> awsList = analyseConfigFile(exe("view", awsNginxHosts.get(0).getHostIp(), null));
73 map.put("awsList", awsList); 73 map.put("awsList", awsList);
74 } 74 }
75 - List<HostInfo> qcloudNginxHosts = hostInfoMapper.selectHostInfosByTagAndCloudType("nginx", 2); 75 + List<HostInfo> qcloudNginxHosts = hostInfoMapper.selectHostInfosByTagAndCloudType("upstream-switch", 2);
76 if(CollectionUtils.isEmpty(qcloudNginxHosts)){ 76 if(CollectionUtils.isEmpty(qcloudNginxHosts)){
77 map.put("qcloudList", Lists.newArrayList()); 77 map.put("qcloudList", Lists.newArrayList());
78 }else { 78 }else {
@@ -152,7 +152,7 @@ public class NginxSwitchCtrl { @@ -152,7 +152,7 @@ public class NginxSwitchCtrl {
152 return new BaseResponse(500, "没有匹配到要切换的云"); 152 return new BaseResponse(500, "没有匹配到要切换的云");
153 } 153 }
154 //获取对应cloud的机器 aws 1 qcloud 2 154 //获取对应cloud的机器 aws 1 qcloud 2
155 - List<HostInfo> nginxHosts = hostInfoMapper.selectHostInfosByTagAndCloudType("nginx", nginxCloudType); 155 + List<HostInfo> nginxHosts = hostInfoMapper.selectHostInfosByTagAndCloudType("upstream-switch", nginxCloudType);
156 if (CollectionUtils.isEmpty(nginxHosts)) { 156 if (CollectionUtils.isEmpty(nginxHosts)) {
157 return new BaseResponse(500, cloudName + "在cmdb中未找到对应的nginx服务器!"); 157 return new BaseResponse(500, cloudName + "在cmdb中未找到对应的nginx服务器!");
158 } 158 }