Publish curated Unraid-AppOps-Gateway source from 451646fee806a47e3256731766980a05a262dcdd
This commit is contained in:
1 parent
532f3d9f26
commit
0a82153d95
43 files changed
+17722
-93
No files matched your search
@@ -28,6 +28,7 @@ from .db.session import engine
|
||||
from .schemas.deployment import DeploymentPlanV1
|
||||
from .schemas.enrollment import EnrollmentPlanV1
|
||||
from .schemas.forge_bootstrap import ForgeBootstrapPreflightV1
|
||||
from .schemas.forge_bootstrap_apply import ForgeBootstrapApplyV1
|
||||
from .services import knowledge_service, mcp_operations, safety_center_service
|
||||
from .services.action_execution import mcp_execution_supported
|
||||
from .services.action_registry import ACTION_RISK, ACTIONS, action_capability
|
||||
@@ -696,6 +697,59 @@ def deployment_preflight(plan: dict[str, Any], idempotencyKey: str) -> dict[str,
|
||||
return {"status": "invalid", "executed": False, "reason": redact_message(str(exc))}
|
||||
|
||||
|
||||
@appops_mcp.tool(name="forge.bootstrap.apply", annotations=_OPERATION_RUN_TOOL)
|
||||
@_tracked("forge.bootstrap.apply")
|
||||
def forge_bootstrap_apply(profile: dict[str, Any], idempotencyKey: str) -> dict[str, Any]:
|
||||
"""Apply one passed, exact-profile Forge first install through its fixed broker route."""
|
||||
if not _MCP_EXECUTION_LOCK.acquire(blocking=False):
|
||||
raise RuntimeError("server_operation_capacity_busy")
|
||||
try:
|
||||
typed_profile = ForgeBootstrapApplyV1.model_validate(profile)
|
||||
from .services.forge_bootstrap_apply import (
|
||||
ForgeBootstrapApplyService,
|
||||
)
|
||||
|
||||
with Session(engine) as session:
|
||||
return _json(
|
||||
ForgeBootstrapApplyService().apply(
|
||||
session,
|
||||
typed_profile,
|
||||
idempotency_key=idempotencyKey,
|
||||
)
|
||||
)
|
||||
except ValueError as exc:
|
||||
return {"status": "invalid", "executed": False, "reason": redact_message(str(exc))}
|
||||
finally:
|
||||
_MCP_EXECUTION_LOCK.release()
|
||||
|
||||
|
||||
@appops_mcp.tool(name="forge.bootstrap.status", annotations=_READ_ONLY_TOOL)
|
||||
@_tracked("forge.bootstrap.status")
|
||||
def forge_bootstrap_status(jobId: str) -> dict[str, Any]:
|
||||
"""Reconcile one existing Forge first-install job using the signed read-only route."""
|
||||
from .services.forge_bootstrap_apply import ForgeBootstrapApplyService
|
||||
|
||||
with Session(engine) as session:
|
||||
result = ForgeBootstrapApplyService().status(session, jobId)
|
||||
return _json(result or {"status": "not_found"})
|
||||
|
||||
|
||||
@appops_mcp.tool(name="forge.bootstrap.resume", annotations=_OPERATION_RUN_TOOL)
|
||||
@_tracked("forge.bootstrap.resume")
|
||||
def forge_bootstrap_resume(jobId: str) -> dict[str, Any]:
|
||||
"""Resume only a signed, pre-migration Forge database-credentials pause."""
|
||||
if not _MCP_EXECUTION_LOCK.acquire(blocking=False):
|
||||
raise RuntimeError("server_operation_capacity_busy")
|
||||
try:
|
||||
from .services.forge_bootstrap_apply import ForgeBootstrapApplyService
|
||||
|
||||
with Session(engine) as session:
|
||||
result = ForgeBootstrapApplyService().resume(session, jobId)
|
||||
return _json(result or {"status": "not_found"})
|
||||
finally:
|
||||
_MCP_EXECUTION_LOCK.release()
|
||||
|
||||
|
||||
@appops_mcp.tool(name="deployment.capabilities", annotations=_READ_ONLY_TOOL)
|
||||
@_tracked("deployment.capabilities")
|
||||
def deployment_capabilities() -> dict[str, Any]:
|
||||
@@ -770,6 +824,11 @@ def deployment_apply(plan: dict[str, Any], idempotencyKey: str) -> dict[str, Any
|
||||
@_tracked("deployment.status")
|
||||
def deployment_status(jobId: str) -> dict[str, Any]:
|
||||
"""Read durable deployment state and refresh a bounded broker request."""
|
||||
if jobId.startswith("forge-install-"):
|
||||
return {
|
||||
"status": "invalid",
|
||||
"reason": "Use forge.bootstrap.status for Forge first-install jobs.",
|
||||
}
|
||||
with Session(engine) as session:
|
||||
try:
|
||||
return _json(DeploymentControlPlane().refresh(session, jobId))
|
||||
|
||||
Reference in new issue
Block a user