v1.1.19: send required+default params (Terraform step 6) + validate-cfs

This commit is contained in:
2026-07-29 11:15:41 +04:00
parent 286c5ab680
commit ca33b45f1a
2 changed files with 28 additions and 3 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ from routes.api import bp as api_bp
from routes.api_test import bp as api_test_bp
# Версия — меняется при КАЖДОМ изменении кода. Показывается в топбаре UI.
VERSION = "1.1.18"
VERSION = "1.1.19"
app = Flask(__name__, template_folder="templates", static_folder="static")
app.config["NUBES_API_ENDPOINT"] = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-test.ngcloud.ru/api/v1/svc")
+25
View File
@@ -198,9 +198,34 @@ def api_test():
print(f"[TRACKER ERROR] add failed: {e}", flush=True)
traceback.print_exc()
# Отправка пользовательских параметров
for pid, pval in params.items():
if pval: # только непустые
client.post("/instanceOperationCfsParams",
{"instanceOperationUid": op_uid, "svcOperationCfsParamId": int(pid), "paramValue": str(pval)})
# Досылка required-параметров с defaultValue (шаг 6 Terraform)
try:
tmpl = client.get(f"/instanceOperations/default/{svc_op_id}")
for p in tmpl.get("svcOperation", {}).get("cfsParams", []):
pid_str = str(p["svcOperationCfsParamId"])
if p.get("isRequired") and pid_str not in params:
dfl = p.get("defaultValue")
if dfl is not None and dfl != "":
client.post("/instanceOperationCfsParams", {
"instanceOperationUid": op_uid,
"svcOperationCfsParamId": p["svcOperationCfsParamId"],
"paramValue": str(dfl)
})
except Exception:
pass # не ронять CREATE если шаблон не загрузился
# Валидация перед запуском
try:
client.get(f"/instanceOperations/{op_uid}/validate-cfs")
except Exception:
pass
client.post(f"/instanceOperations/{op_uid}/run")
# фоном ждать завершения