...
|
...
|
@@ -3,6 +3,7 @@ package com.monitor.switchs; |
|
|
import com.model.HostInfo;
|
|
|
import com.monitor.model.response.BaseResponse;
|
|
|
import com.monitor.mysql.mapper.HostInfoMapper;
|
|
|
import com.yoho.ops.cmdb.qcloud.util.QcloudDnspotUtil;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
...
|
...
|
@@ -162,7 +163,7 @@ public class LuaSwitchCtrl { |
|
|
@ResponseBody
|
|
|
public BaseResponse dnsViewConf() {
|
|
|
try{
|
|
|
String result = exeDns("status");
|
|
|
String result = QcloudDnspotUtil.recordList();
|
|
|
return new BaseResponse(200, "success", result);
|
|
|
}catch (Exception e){
|
|
|
logger.error(" LuaSwitchCtrl - dnsViewConf - 1 - error" , e);
|
...
|
...
|
@@ -170,18 +171,6 @@ public class LuaSwitchCtrl { |
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 执行命令
|
|
|
*
|
|
|
* @param commod
|
|
|
* @return
|
|
|
*/
|
|
|
public String exeDns(String commod) {
|
|
|
StringBuilder commond = new StringBuilder();
|
|
|
commond.append(" " + commod);
|
|
|
return CommodUtil.exeDns(CommodUtil.DNS_POD, commond.toString());
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 切换dns配置,是基于api的切换,直接切换
|
...
|
...
|
@@ -199,12 +188,14 @@ public class LuaSwitchCtrl { |
|
|
}else if("toQcloud".equals(cloudName)){
|
|
|
cloud = "qcloud";
|
|
|
}
|
|
|
|
|
|
//如果切向双云,则默认到aws
|
|
|
if("mix".equals(cloudName)){
|
|
|
cloudName = "toAws";
|
|
|
}
|
|
|
|
|
|
//1:切dns
|
|
|
String result = exeDns(cloudName);
|
|
|
String result = QcloudDnspotUtil.recordModify(cloudName);
|
|
|
//2:切 dns_resolver_worker.lua -> context.cloud_flag
|
|
|
viewToChangeLuaConf(cloud, request);
|
|
|
switchConf(request);
|
...
|
...
|
|