Authored by xuhui

伸缩完毕后,修改git上的iptables

... ... @@ -301,4 +301,9 @@ public class HttpUriContants {
* 部署完系统后,集成测试
*/
public static final String GET_CLOUD_INTEGRATION_TEST = "/cloud/integrationTest";
/**
* 部署完系统后,集成测试完成后,修改iptables脚本
*/
public static final String GET_CLOUD_UPDATE_IP_TO_GIT = "/cloud/updateIpToGit";
}
\ No newline at end of file
... ...
... ... @@ -168,4 +168,20 @@ public class AutoScalingCtrl {
BaseResponse<?> response = httpClient.defaultPost(url, null, BaseResponse.class);
return response;
}
/**
* 自动伸缩后,修改ip,ip从云管理中心重新获取
* http://git.yoho.cn/yohoops/auto_deploy.git
* @param cloudType 云类型 1:AWS 2:QCLOUD
* @param projectName 项目名称
* @return
*/
@RequestMapping("/updateIpToGit")
@ResponseBody
public BaseResponse<?> updateIpToGit(int cloudType, String projectName, String scalingGroupId){
String url = String.format(HttpUriContants.GET_CLOUD_UPDATE_IP_TO_GIT+"?cloudType=%s&projectName=%s&scalingGroupId=%s",cloudType, projectName, scalingGroupId);
BaseResponse<?> response = httpClient.defaultPost(url, null, BaseResponse.class);
return response;
}
}
\ No newline at end of file
... ...
... ... @@ -350,6 +350,7 @@ function deploy(instanceIds){
deployLaster();
return;
}
writeToText("正在部署系统,请稍后...");
//3:根据ip部署项目,得到消息id
var messageId = deployProject(ips);
... ... @@ -453,14 +454,6 @@ function deployProjectGetMsg(msgId, ips){
//4:集成测试
integrationTest(ips);
//5:更新git文件
editToGit(ips);
//部署全部成功后执行
deployLaster();
writeToText("完毕..........");
}
},
error: function (e) {
... ... @@ -491,6 +484,10 @@ function integrationTest(ips){
var stateMsg;
if(state == 200){
stateMsg = "成功访问";
writeToText("正在更新git-iptables,请稍后...");
//5:更新git文件
editToGit();
}else{
stateMsg = "访问失败";
}
... ... @@ -506,14 +503,35 @@ function integrationTest(ips){
}
//5:ip写入git
function editToGit(ips){
function editToGit(){
var url = '/autoScalingTool/updateIpToGit?cloudType='+$("#cloudType").val()+'&projectName='+scalingGroupName+'&scalingGroupId=' + souScalingGroupId;
$.ajax({
url: url,
type: 'POST',
dataType: 'json',
async: false,
success: function (data) {
if (!data || data.code != 200) {
responseError(data);
}else{
writeToText(" ");
writeToText("更新之后的ip集合是:"+data.message);
writeToText("第 5 步:更新git - app-iptable文件成功!");
writeToText("第 5 步:更新git - app-iptable文件成功!");
//部署全部成功后执行
deployLaster();
writeToText("完毕..........");
}
},
error: function (e) {
requestError(url);
}
});
}
//缩容成功后执行
function unDeploy(){
//发布完之后,显示关闭按钮
$("#closeButton").removeAttr("disabled");
... ...