|
@@ -4,6 +4,8 @@ import com.model.JavaApiInfo; |
|
@@ -4,6 +4,8 @@ import com.model.JavaApiInfo; |
4
|
import com.model.MObjectInfo;
|
4
|
import com.model.MObjectInfo;
|
5
|
import com.model.TypeInfo;
|
5
|
import com.model.TypeInfo;
|
6
|
import com.monitor.awstools.service.AwsQueryService;
|
6
|
import com.monitor.awstools.service.AwsQueryService;
|
|
|
7
|
+import com.monitor.cloudtools.model.CommAutoScalingGroup;
|
|
|
8
|
+import com.monitor.cloudtools.model.CommAutoScalingInstances;
|
7
|
import com.monitor.cloudtools.model.CommTestResponse;
|
9
|
import com.monitor.cloudtools.model.CommTestResponse;
|
8
|
import com.monitor.cloudtools.service.CloudToolService;
|
10
|
import com.monitor.cloudtools.service.CloudToolService;
|
9
|
import com.monitor.cloudtools.util.CommodUtil;
|
11
|
import com.monitor.cloudtools.util.CommodUtil;
|
|
@@ -21,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
@@ -21,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
21
|
import org.springframework.stereotype.Service;
|
23
|
import org.springframework.stereotype.Service;
|
22
|
|
24
|
|
23
|
import java.util.ArrayList;
|
25
|
import java.util.ArrayList;
|
|
|
26
|
+import java.util.Arrays;
|
24
|
import java.util.List;
|
27
|
import java.util.List;
|
25
|
|
28
|
|
26
|
/**
|
29
|
/**
|
|
@@ -149,13 +152,13 @@ public class CloudToolServiceImpl implements CloudToolService { |
|
@@ -149,13 +152,13 @@ public class CloudToolServiceImpl implements CloudToolService { |
149
|
* 自动伸缩后,修改ip,ip从云管理中心重新获取
|
152
|
* 自动伸缩后,修改ip,ip从云管理中心重新获取
|
150
|
* @param cloudType 云类型 1:AWS 2:QCLOUD
|
153
|
* @param cloudType 云类型 1:AWS 2:QCLOUD
|
151
|
* @param projectName 项目名称
|
154
|
* @param projectName 项目名称
|
152
|
- * @param scalingGroupId 伸缩组ID
|
155
|
+ * @param newInstanceIps 伸缩组新的ips
|
153
|
* @return
|
156
|
* @return
|
154
|
*/
|
157
|
*/
|
155
|
@Override
|
158
|
@Override
|
156
|
- public BaseResponse updateIpToGit(int cloudType, String projectName, String scalingGroupId) {
|
159
|
+ public BaseResponse updateIpToGit(int cloudType, String projectName, String newInstanceIps) {
|
157
|
BaseResponse response = new BaseResponse();
|
160
|
BaseResponse response = new BaseResponse();
|
158
|
- if(StringUtils.isBlank(projectName) || StringUtils.isBlank(scalingGroupId)){
|
161
|
+ if(StringUtils.isBlank(projectName)){
|
159
|
response.setCode(300);
|
162
|
response.setCode(300);
|
160
|
response.setMessage("参数不全");
|
163
|
response.setMessage("参数不全");
|
161
|
return response;
|
164
|
return response;
|
|
@@ -163,53 +166,20 @@ public class CloudToolServiceImpl implements CloudToolService { |
|
@@ -163,53 +166,20 @@ public class CloudToolServiceImpl implements CloudToolService { |
163
|
String commond = "ssh master@172.31.16.167 sh /home/master/auto_deploy/deploy/update-ips.sh -a%s -e%s -i%s";
|
166
|
String commond = "ssh master@172.31.16.167 sh /home/master/auto_deploy/deploy/update-ips.sh -a%s -e%s -i%s";
|
164
|
|
167
|
|
165
|
try{
|
168
|
try{
|
166
|
- List<String> ips = null;
|
169
|
+ List<String> ips = new ArrayList<String>();
|
|
|
170
|
+ if(StringUtils.isNotBlank(newInstanceIps)){
|
|
|
171
|
+ for(String ip:newInstanceIps.split(",")){
|
|
|
172
|
+ if(StringUtils.isNotBlank(ip)){
|
|
|
173
|
+ ips.add(ip);
|
|
|
174
|
+ }
|
|
|
175
|
+ }
|
|
|
176
|
+ }
|
167
|
String cloudTypeStr = "";
|
177
|
String cloudTypeStr = "";
|
168
|
String projectNameStr = "";
|
178
|
String projectNameStr = "";
|
169
|
if(1 == cloudType){
|
179
|
if(1 == cloudType){
|
170
|
cloudTypeStr = "aws";
|
180
|
cloudTypeStr = "aws";
|
171
|
projectNameStr = projectName.replace('-', '_') + "_aws_ips";
|
181
|
projectNameStr = projectName.replace('-', '_') + "_aws_ips";
|
172
|
}else if(2 == cloudType){
|
182
|
}else if(2 == cloudType){
|
173
|
- ips = qCloudToolService.getIpsByScalingGroupId(scalingGroupId);
|
|
|
174
|
-
|
|
|
175
|
- //特殊处理:腾讯云不是70段的ip
|
|
|
176
|
- /*if("asg-kwwpxavl".equals(scalingGroupId)){
|
|
|
177
|
- //gateway项目
|
|
|
178
|
- if(!ips.contains("10.66.0.4")){
|
|
|
179
|
- ips.add("10.66.0.4");
|
|
|
180
|
- }
|
|
|
181
|
- if(!ips.contains("10.66.0.5")){
|
|
|
182
|
- ips.add("10.66.0.5");
|
|
|
183
|
- }
|
|
|
184
|
- if(!ips.contains("10.66.0.240")){
|
|
|
185
|
- ips.add("10.66.0.240");
|
|
|
186
|
- }
|
|
|
187
|
- }else if("asg-87m9rp31".equals(scalingGroupId)){
|
|
|
188
|
- //uic
|
|
|
189
|
- if(!ips.contains("10.66.0.24")){
|
|
|
190
|
- ips.add("10.66.0.24");
|
|
|
191
|
- }
|
|
|
192
|
- if(!ips.contains("10.66.0.178")){
|
|
|
193
|
- ips.add("10.66.0.178");
|
|
|
194
|
- }
|
|
|
195
|
- }else if("asg-1llhxawt".equals(scalingGroupId)){
|
|
|
196
|
- //activity-brower-bigdata
|
|
|
197
|
- if(!ips.contains("10.66.0.158")){
|
|
|
198
|
- ips.add("10.66.0.158");
|
|
|
199
|
- }
|
|
|
200
|
- if(!ips.contains("10.66.0.219")){
|
|
|
201
|
- ips.add("10.66.0.219");
|
|
|
202
|
- }
|
|
|
203
|
- }else if("asg-c1qbtoxh".equals(scalingGroupId)){
|
|
|
204
|
- //search-service
|
|
|
205
|
- if(!ips.contains("10.66.5.5")){
|
|
|
206
|
- ips.add("10.66.5.5");
|
|
|
207
|
- }
|
|
|
208
|
- if(!ips.contains("10.66.5.4")){
|
|
|
209
|
- ips.add("10.66.5.4");
|
|
|
210
|
- }
|
|
|
211
|
- }*/
|
|
|
212
|
-
|
|
|
213
|
cloudTypeStr = "qcloud";
|
183
|
cloudTypeStr = "qcloud";
|
214
|
projectNameStr = projectName.replace('-', '_') + "_qcloud_ips";
|
184
|
projectNameStr = projectName.replace('-', '_') + "_qcloud_ips";
|
215
|
}
|
185
|
}
|