v1.1.24: step 6 from REAL operation (not template) — fixes serviceInstanceUid

This commit is contained in:
2026-07-29 12:59:13 +04:00
parent 82b674d05f
commit d3164ebe76
2 changed files with 10 additions and 11 deletions
+9 -10
View File
@@ -205,26 +205,25 @@ def api_test():
client.post("/instanceOperationCfsParams",
{"instanceOperationUid": op_uid, "svcOperationCfsParamId": int(pid), "paramValue": str(pval)})
# Досылка required-параметров с defaultValue (шаг 6 Terraform)
# Досылка required-параметров (шаг 6 Terraform)
# Берём из РЕАЛЬНОЙ операции — не из шаблона (там нет paramValue)
try:
tmpl = client.get(f"/instanceOperations/default/{svc_op_id}")
for p in tmpl.get("svcOperation", {}).get("cfsParams", []):
op_det = client.get(f"/instanceOperations/{op_uid}?fields=cfsParams")
for p in op_det.get("instanceOperation", {}).get("cfsParams", []):
pid_str = str(p["svcOperationCfsParamId"])
if p.get("isRequired") and pid_str not in params:
dfl = p.get("defaultValue")
val = p.get("paramValue") or p.get("defaultValue")
dd = p.get("dataDescriptor")
if dfl is not None and dfl != "":
# Есть явный default — отправляем как есть
if val is not None and val != "":
client.post("/instanceOperationCfsParams", {
"instanceOperationUid": op_uid,
"svcOperationCfsParamId": p["svcOperationCfsParamId"],
"paramValue": str(dfl)
"paramValue": str(val)
})
elif isinstance(dd, dict):
# map-fixed без явного default — собираем JSON из sub-param defaults
sub_obj = {}
for sk, sv in dd.items():
sd = sv.get("defaultValue", "")
sd = sv.get("paramValue") or sv.get("defaultValue", "")
if sv.get("isRequired") and sd:
sub_obj[sk] = sd
if sub_obj:
@@ -234,7 +233,7 @@ def api_test():
"paramValue": json.dumps(sub_obj)
})
except Exception:
pass # не ронять CREATE если шаблон не загрузился
pass
# Валидация перед запуском
try: