Fix: 3-step - /instances → /instanceOperations → /params → /run, v1.0.24

This commit is contained in:
2026-07-24 09:44:30 +04:00
parent abec85bdbf
commit 049513cfbc
2 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ from routes.main import bp as main_bp
from routes.api import bp as api_bp
from routes.api_test import bp as api_test_bp
VERSION = "1.0.23"
VERSION = "1.0.24"
app = Flask(__name__, template_folder="templates", static_folder="static")
app.config["NUBES_API_ENDPOINT"] = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-dev.ngcloud.ru/api/v1/svc")
+5 -3
View File
@@ -95,14 +95,16 @@ def api_test():
resp = client.post("/instances", payload)
instance_uid = resp.get("instanceUid") or _find_uid(resp) or _uid_from_location(resp.get("_location", ""))
# Шаг 2: запустить операцию create с параметрами
# Шаг 2: создать операцию, задать параметры, запустить
if instance_uid:
op_payload = {"instanceUid": instance_uid, "operation": "create"}
if params:
op_payload["cfsParams"] = [{"svcOperationCfsParamId": int(k), "paramValue": str(v)} for k, v in params.items()]
op_resp = client.post("/instanceOperations", op_payload)
op_uid = _find_uid(op_resp) or _uid_from_location(op_resp.get("_location", ""))
if op_uid:
# задать cfsParams
for pid, pval in params.items():
client.post(f"/instanceOperations/{op_uid}/params",
{"svcOperationCfsParamId": int(pid), "paramValue": str(pval)})
client.post(f"/instanceOperations/{op_uid}/run")
# wait