|
@@ -276,18 +276,18 @@ def stop_instances(ecs_client, instance_ids, force_stop=False):
|
|
|
|
|
|
|
|
|
|
|
|
-def send_request(ecs_client, request):
|
|
|
+def send_request(client, request):
|
|
|
"""
|
|
|
发送API请求
|
|
|
- :param ecs_client: 客户端连接
|
|
|
+ :param client: 客户端连接
|
|
|
:param request: 请求配置
|
|
|
:return: response
|
|
|
"""
|
|
|
request.set_accept_format('json')
|
|
|
try:
|
|
|
- response = ecs_client.do_action_with_exception(request)
|
|
|
+ response = client.do_action_with_exception(request)
|
|
|
response = json.loads(response)
|
|
|
- logging.info(response)
|
|
|
+ # logging.info(response)
|
|
|
return response
|
|
|
except Exception as e:
|
|
|
# 失败,记录报错信息,发送通知,停止并退出
|
|
@@ -313,7 +313,7 @@ def run_command(ecs_client, instance_ids, command):
|
|
|
request.set_Type("RunShellScript")
|
|
|
request.set_CommandContent(command)
|
|
|
request.set_InstanceIds(instance_id_list)
|
|
|
- response = send_request(ecs_client=ecs_client, request=request)
|
|
|
+ response = send_request(client=ecs_client, request=request)
|
|
|
logging.info(response)
|
|
|
|
|
|
|