fix: create_client → get_client — POLYGON_ENDPOINT в main/api/runner (v1.2.27)
This commit is contained in:
+4
-4
@@ -2,7 +2,7 @@ import threading
|
||||
|
||||
from flask import Blueprint, current_app, jsonify, request
|
||||
|
||||
from api.http_client import create_client
|
||||
from api.auth import get_client
|
||||
from runner import run_tests, get_status, load_config, save_config
|
||||
|
||||
bp = Blueprint("api", __name__)
|
||||
@@ -11,10 +11,10 @@ bp = Blueprint("api", __name__)
|
||||
@bp.route("/api/run", methods=["POST"])
|
||||
def api_run():
|
||||
token = current_app.config["NUBES_API_TOKEN"]
|
||||
result = create_client(token, current_app.config["NUBES_API_ENDPOINT"])
|
||||
if not result:
|
||||
client = get_client()
|
||||
endpoint = current_app.config["NUBES_API_ENDPOINT"]
|
||||
if not client:
|
||||
return jsonify({"error": "Не удалось определить стенд"}), 500
|
||||
client, endpoint = result
|
||||
t = threading.Thread(
|
||||
target=run_tests,
|
||||
args=(endpoint, token),
|
||||
|
||||
+9
-11
@@ -11,7 +11,7 @@ GET /api/operations/<svc_id> — операции и autotest-инста
|
||||
from flask import Blueprint, current_app, render_template, request, make_response, jsonify, redirect
|
||||
|
||||
from api.http_client import HttpClient, detect_endpoint, create_client, stand_name
|
||||
from api.auth import get_token, get_client_id, get_token_info, get_token_masked
|
||||
from api.auth import get_token, get_client_id, get_token_info, get_token_masked, get_client, get_stand
|
||||
from operations.get_instances import get_organization, get_instances
|
||||
from operations.get_services import get_services, get_service_detail
|
||||
from operations.service_list import load_service_ids
|
||||
@@ -105,11 +105,11 @@ def index():
|
||||
config["service_ids"] = []
|
||||
stand = "?"
|
||||
if active_token:
|
||||
# create_client — автоопределение стенда + HttpClient
|
||||
result = create_client(active_token, current_app.config["NUBES_API_ENDPOINT"])
|
||||
if result:
|
||||
client, endpoint = result
|
||||
stand = stand_name(endpoint)
|
||||
# get_client — учитывает POLYGON_ENDPOINT
|
||||
client = get_client()
|
||||
endpoint = current_app.config["NUBES_API_ENDPOINT"]
|
||||
stand = get_stand()
|
||||
if client:
|
||||
try:
|
||||
# Организация — инстанс с serviceId=19
|
||||
org = get_organization(client)
|
||||
@@ -168,11 +168,9 @@ def api_operations(svc_id):
|
||||
active_token = user_token or env_token
|
||||
|
||||
try:
|
||||
# Автоопределение стенда + HttpClient
|
||||
result = create_client(active_token, current_app.config["NUBES_API_ENDPOINT"])
|
||||
if not result:
|
||||
return jsonify({"error": "Не удалось определить стенд"}), 500
|
||||
client, endpoint = result
|
||||
# get_client — учитывает POLYGON_ENDPOINT
|
||||
client = get_client()
|
||||
endpoint = current_app.config["NUBES_API_ENDPOINT"]
|
||||
|
||||
# Детали сервиса: список операций (modify, delete, suspend, ...)
|
||||
detail = get_service_detail(client, svc_id)
|
||||
|
||||
Reference in New Issue
Block a user