|
@@ -276,16 +276,16 @@ def stop_instances(ecs_client, instance_ids, force_stop=False):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-def send_request(client, request):
|
|
|
|
|
|
+def send_request(ecs_client, request):
|
|
"""
|
|
"""
|
|
发送API请求
|
|
发送API请求
|
|
- :param client: 客户端连接
|
|
|
|
|
|
+ :param ecs_client: 客户端连接
|
|
:param request: 请求配置
|
|
:param request: 请求配置
|
|
:return: response
|
|
:return: response
|
|
"""
|
|
"""
|
|
request.set_accept_format('json')
|
|
request.set_accept_format('json')
|
|
try:
|
|
try:
|
|
- response = client.do_action_with_exception(request)
|
|
|
|
|
|
+ response = ecs_client.do_action_with_exception(request)
|
|
response = json.loads(response)
|
|
response = json.loads(response)
|
|
# logging.info(response)
|
|
# logging.info(response)
|
|
return response
|
|
return response
|
|
@@ -313,7 +313,7 @@ def run_command(ecs_client, instance_ids, command):
|
|
request.set_Type("RunShellScript")
|
|
request.set_Type("RunShellScript")
|
|
request.set_CommandContent(command)
|
|
request.set_CommandContent(command)
|
|
request.set_InstanceIds(instance_id_list)
|
|
request.set_InstanceIds(instance_id_list)
|
|
- response = send_request(client=ecs_client, request=request)
|
|
|
|
|
|
+ response = send_request(ecs_client=ecs_client, request=request)
|
|
logging.info(response)
|
|
logging.info(response)
|
|
|
|
|
|
|
|
|