...
|
...
|
@@ -52,14 +52,22 @@ public class NginxSwitchCtrl { |
|
|
Map<String, List<Map<String, Object>>> map = new HashMap<>();
|
|
|
|
|
|
//获取灰度机器的server。ip
|
|
|
Map<String, Object> tmpmap=new HashMap<String, Object>();
|
|
|
tmpmap.put("grayServerHosts", getGatewayHostIPs(HostTagConstant.tag_huidu_cn));
|
|
|
tmpmap.put("az1ServerHosts", getGatewayHostIPs(HostTagConstant.tag_az1));
|
|
|
tmpmap.put("az2ServerHosts", getGatewayHostIPs(HostTagConstant.tag_az2));
|
|
|
Map<String, Object> gatewayHostsMap=new HashMap<String, Object>();
|
|
|
gatewayHostsMap.put("grayServerHosts", getGatewayHostIPs(HostTagConstant.tag_huidu_cn));
|
|
|
gatewayHostsMap.put("az1ServerHosts", getGatewayHostIPs(HostTagConstant.tag_az1));
|
|
|
gatewayHostsMap.put("az2ServerHosts", getGatewayHostIPs(HostTagConstant.tag_az2));
|
|
|
List<Map<String, Object>> gatewayHosts=new ArrayList<>();
|
|
|
gatewayHosts.add(tmpmap);
|
|
|
gatewayHosts.add(gatewayHostsMap);
|
|
|
map.put("gatewayServerHosts", gatewayHosts);
|
|
|
|
|
|
//获取nginx机器列表
|
|
|
Map<String, Object> nginxHostsMap=new HashMap<String, Object>();
|
|
|
nginxHostsMap.put("az1NginxHosts", getUpstreamTagNginxHostIps(2,HostTagConstant.tag_az1));
|
|
|
nginxHostsMap.put("az2NginxHosts", getUpstreamTagNginxHostIps(2,HostTagConstant.tag_az2));
|
|
|
List<Map<String, Object>> nginxHosts=new ArrayList<>();
|
|
|
nginxHosts.add(nginxHostsMap);
|
|
|
map.put("nginxServerHosts", nginxHosts);
|
|
|
|
|
|
if ("test1".equals(env)||"test".equals(env)) {
|
|
|
List<Map<String, Object>> az2List = localTest("az2");
|
|
|
List<Map<String, Object>> qcloudList = localTest("qq");
|
...
|
...
|
@@ -98,6 +106,13 @@ public class NginxSwitchCtrl { |
|
|
}
|
|
|
}
|
|
|
|
|
|
private List<String> getUpstreamTagNginxHostIps(int cloud,String azTag){
|
|
|
List<HostInfo> hosts=getUpstreamTagNginxHostList(cloud,azTag);
|
|
|
if(CollectionUtils.isNotEmpty(hosts)){
|
|
|
return hosts.stream().map(p->p.getHostIp()).collect(Collectors.toList());
|
|
|
}
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
private List<HostInfo> getUpstreamTagNginxHostList(int cloud,String azTag){
|
|
|
if(1==cloud){
|
|
|
return hostInfoMapper.selectHostInfosByTagAndCloudType(HostTagConstant.tag_upstreamSwitch, 1);
|
...
|
...
|
|