v1.1.52: fix scenario create (drop svcOperationId) + http_client _status debug
This commit is contained in:
@@ -105,11 +105,12 @@ class HttpClient:
|
||||
r = self._session.post(url, json=(data if data is not None else {}), **kwargs)
|
||||
if not r.ok:
|
||||
raise Exception(f"POST {path}: {r.status_code} {r.reason}: {r.text[:200]}")
|
||||
result = {}
|
||||
result = {"_status": r.status_code}
|
||||
try:
|
||||
parsed = r.json()
|
||||
if isinstance(parsed, dict):
|
||||
result = parsed
|
||||
result["_status"] = r.status_code
|
||||
except Exception:
|
||||
pass # тело не JSON или не dict — ок, Location всё равно извлечём
|
||||
loc = r.headers.get("Location", "")
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ from routes.api_test import bp as api_test_bp
|
||||
from routes.api_scenario import bp as api_scenario_bp
|
||||
|
||||
# Версия — меняется при КАЖДОМ изменении кода. Показывается в топбаре UI.
|
||||
VERSION = "1.1.51"
|
||||
VERSION = "1.1.52"
|
||||
|
||||
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")
|
||||
|
||||
@@ -124,6 +124,9 @@ def run_scenario(client, steps, client_id, stand, user_email, app_version, scena
|
||||
raise RuntimeError(f"No instance for service_id {svc_id} — need CREATE first")
|
||||
|
||||
# 4. Запуск операции
|
||||
if op_name == "create":
|
||||
op_payload = {"instanceUid": instance_uid, "operation": op_name}
|
||||
else:
|
||||
op_payload = {"instanceUid": instance_uid, "svcOperationId": svc_op_id, "operation": op_name}
|
||||
op_resp = client.post("/instanceOperations", op_payload)
|
||||
op_uid = op_resp.get("instanceOperationUid") or _find_uid(op_resp) or _uid_from_location(op_resp.get("_location", ""))
|
||||
|
||||
Reference in New Issue
Block a user