From be7c170c36d86e4ae5646552a9872218f777042b Mon Sep 17 00:00:00 2001 From: jetzhang Date: Thu, 21 Aug 2025 16:50:34 +0800 Subject: [PATCH] Update index.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改bug --- Python3.6-AutoRecovery/src/index.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Python3.6-AutoRecovery/src/index.py b/Python3.6-AutoRecovery/src/index.py index fe6a25993..339b08944 100644 --- a/Python3.6-AutoRecovery/src/index.py +++ b/Python3.6-AutoRecovery/src/index.py @@ -143,13 +143,12 @@ def main_handler(event, context): run_command = os.environ.get('run_Command') run_command_base = base64.b64encode(run_command.encode('utf-8')) - # 判断服务器是否在 RUNNING 状态 - status_get = get_cvm_status(timestamp, date, secretid, secretkey, region, insid) - status = json.loads(status_get)["Response"]["InstanceSet"][0]["InstanceState"] - print(status) - loop = 1 while loop <= 6: + # 判断服务器是否在 RUNNING 状态 + status_get = get_cvm_status(timestamp, date, secretid, secretkey, region, insid) + status = json.loads(status_get)["Response"]["InstanceSet"][0]["InstanceState"] + print(status) if status == 'RUNNING': # 服务器命令执行 time.sleep(10) @@ -162,4 +161,4 @@ def main_handler(event, context): loop += 1 else: print("机器状态未就绪!") - return ("机器状态未就绪!") \ No newline at end of file + return ("机器状态未就绪!")