Authored by zhouxiang

功能tag定义

... ... @@ -43,7 +43,7 @@ public class LbSwitchCtrl {
@ResponseBody
public BaseResponse viewConf() throws Exception {
//直连的配置放在腾讯云nginx上
List<HostInfo> qcloudNginxHosts = hostInfoMapper.selectHostInfosByTag("直连");
List<HostInfo> qcloudNginxHosts = hostInfoMapper.selectHostInfosByTag("lb-switch");
if (CollectionUtils.isEmpty(qcloudNginxHosts)) {
throw new Exception("没有找到直连nginx服务器");
}
... ... @@ -79,7 +79,7 @@ public class LbSwitchCtrl {
String path = request.getSession().getServletContext().getRealPath("/") + "lua/lb.lua";
logger.info("lb.lua template path {}", path);
//lua dns 只放在腾讯云nginx服务器上
List<HostInfo> nginxHosts = hostInfoMapper.selectHostInfosByTag("直连");
List<HostInfo> nginxHosts = hostInfoMapper.selectHostInfosByTag("lb-switch");
if (CollectionUtils.isEmpty(nginxHosts)) {
return new BaseResponse(500, "在cmdb中未找到直连对应的nginx服务器!");
}
... ...
... ... @@ -49,7 +49,7 @@ public class LuaSwitchCtrl {
@RequestMapping(value = "viewConf")
@ResponseBody
public String viewConf() throws Exception {
List<HostInfo> qcloudNginxHosts = hostInfoMapper.selectHostInfosByTagAndCloudType("nginx", 2);
List<HostInfo> qcloudNginxHosts = hostInfoMapper.selectHostInfosByTag("lua-switch");
if (CollectionUtils.isEmpty(qcloudNginxHosts)) {
throw new Exception("没有找到nginx服务器");
}
... ... @@ -83,7 +83,7 @@ public class LuaSwitchCtrl {
String path = request.getSession().getServletContext().getRealPath("/") + "lua/dns_resolver_worker.lua";
logger.info("path {}", path);
//lua dns 只放在腾讯云nginx服务器上
List<HostInfo> nginxHosts = hostInfoMapper.selectHostInfosByTagAndCloudType("nginx", 2);
List<HostInfo> nginxHosts = hostInfoMapper.selectHostInfosByTag("lua-switch");
if (CollectionUtils.isEmpty(nginxHosts)) {
return new BaseResponse(500, "腾讯云在cmdb中未找到对应的nginx服务器!");
}
... ...
... ... @@ -44,7 +44,7 @@ public class NginxLimit {
@RequestMapping(value = "viewConf")
@ResponseBody
public BaseResponse viewConf() throws Exception {
List<HostInfo> qcloudNginxHosts = hostInfoMapper.selectHostInfosByTag("限流");
List<HostInfo> qcloudNginxHosts = hostInfoMapper.selectHostInfosByTag("limit-switch");
if (CollectionUtils.isEmpty(qcloudNginxHosts)) {
throw new Exception("没有找到限流nginx服务器");
}
... ... @@ -95,7 +95,7 @@ public class NginxLimit {
@ResponseBody
public BaseResponse switchNginxConf(HttpServletRequest httpRequest) {
//获取对应cloud的机器 aws 1 qcloud 2
List<HostInfo> nginxHosts = hostInfoMapper.selectHostInfosByTag("限流");
List<HostInfo> nginxHosts = hostInfoMapper.selectHostInfosByTag("limit-switch");
if (CollectionUtils.isEmpty(nginxHosts)) {
return new BaseResponse(500, "在cmdb中未找到限流对应的nginx服务器!");
}
... ...
... ... @@ -65,14 +65,14 @@ public class NginxSwitchCtrl {
return new BaseResponse(map);
}*/
List<HostInfo> awsNginxHosts = hostInfoMapper.selectHostInfosByTagAndCloudType("nginx", 1);
List<HostInfo> awsNginxHosts = hostInfoMapper.selectHostInfosByTagAndCloudType("upstream-switch", 1);
if(CollectionUtils.isEmpty(awsNginxHosts)){
map.put("awsList", Lists.newArrayList());
}else {
List<Map<String, Object>> awsList = analyseConfigFile(exe("view", awsNginxHosts.get(0).getHostIp(), null));
map.put("awsList", awsList);
}
List<HostInfo> qcloudNginxHosts = hostInfoMapper.selectHostInfosByTagAndCloudType("nginx", 2);
List<HostInfo> qcloudNginxHosts = hostInfoMapper.selectHostInfosByTagAndCloudType("upstream-switch", 2);
if(CollectionUtils.isEmpty(qcloudNginxHosts)){
map.put("qcloudList", Lists.newArrayList());
}else {
... ... @@ -152,7 +152,7 @@ public class NginxSwitchCtrl {
return new BaseResponse(500, "没有匹配到要切换的云");
}
//获取对应cloud的机器 aws 1 qcloud 2
List<HostInfo> nginxHosts = hostInfoMapper.selectHostInfosByTagAndCloudType("nginx", nginxCloudType);
List<HostInfo> nginxHosts = hostInfoMapper.selectHostInfosByTagAndCloudType("upstream-switch", nginxCloudType);
if (CollectionUtils.isEmpty(nginxHosts)) {
return new BaseResponse(500, cloudName + "在cmdb中未找到对应的nginx服务器!");
}
... ...