v1.1.19: send required+default params (Terraform step 6) + validate-cfs
This commit is contained in:
+1
-1
@@ -18,7 +18,7 @@ from routes.api import bp as api_bp
|
|||||||
from routes.api_test import bp as api_test_bp
|
from routes.api_test import bp as api_test_bp
|
||||||
|
|
||||||
# Версия — меняется при КАЖДОМ изменении кода. Показывается в топбаре UI.
|
# Версия — меняется при КАЖДОМ изменении кода. Показывается в топбаре UI.
|
||||||
VERSION = "1.1.18"
|
VERSION = "1.1.19"
|
||||||
|
|
||||||
app = Flask(__name__, template_folder="templates", static_folder="static")
|
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")
|
app.config["NUBES_API_ENDPOINT"] = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-test.ngcloud.ru/api/v1/svc")
|
||||||
|
|||||||
+27
-2
@@ -198,9 +198,34 @@ def api_test():
|
|||||||
print(f"[TRACKER ERROR] add failed: {e}", flush=True)
|
print(f"[TRACKER ERROR] add failed: {e}", flush=True)
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
|
# Отправка пользовательских параметров
|
||||||
for pid, pval in params.items():
|
for pid, pval in params.items():
|
||||||
client.post("/instanceOperationCfsParams",
|
if pval: # только непустые
|
||||||
{"instanceOperationUid": op_uid, "svcOperationCfsParamId": int(pid), "paramValue": str(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")
|
client.post(f"/instanceOperations/{op_uid}/run")
|
||||||
|
|
||||||
# фоном ждать завершения
|
# фоном ждать завершения
|
||||||
|
|||||||
Reference in New Issue
Block a user