Publish curated Unraid-AppOps-Gateway source from 6d175c3333218e2b580a310496fed6c407f28114

This commit is contained in:
Public Source Publisher committed 2026-10-09 12:15:31 +00:00
1 parent 58f5e3c8c2
commit 41fd48f0bc
7 files changed
+339 -16

No files matched your search

+16 -1
View File
@@ -15,7 +15,7 @@ from typing import Any
from mcp.server import MCPServer
from mcp.server.transport_security import TransportSecuritySettings
from mcp.types import ToolAnnotations
from pydantic import StrictBool
from pydantic import StrictBool, ValidationError
from sqlmodel import Session, select
from .api.routes_actions import action_registry as build_action_registry
@@ -894,6 +894,9 @@ def deployment_preflight(plan: dict[str, Any], idempotencyKey: str) -> dict[str,
operation="preflight",
)
)
except ValidationError:
# Pydantic errors may contain arbitrary keys, input values and validator context.
return {"status": "invalid", "executed": False, "reason": "invalid_typed_plan"}
except (ValueError, DeploymentControlError) as exc:
return {"status": "invalid", "executed": False, "reason": redact_message(str(exc))}
@@ -918,6 +921,8 @@ def forge_bootstrap_apply(profile: dict[str, Any], idempotencyKey: str) -> dict[
idempotency_key=idempotencyKey,
)
)
except ValidationError:
return {"status": "invalid", "executed": False, "reason": "invalid_typed_plan"}
except ValueError as exc:
return {"status": "invalid", "executed": False, "reason": redact_message(str(exc))}
finally:
@@ -967,6 +972,8 @@ def enrollment_preflight(plan: dict[str, Any]) -> dict[str, Any]:
typed_plan = EnrollmentPlanV1.model_validate(plan)
with Session(engine) as session:
return _json(EnrollmentPlane().preflight(session, typed_plan))
except ValidationError:
return {"status": "invalid", "executed": False, "reason": "invalid_typed_plan"}
except (ValueError, EnrollmentError) as exc:
return {"status": "invalid", "executed": False, "reason": redact_message(str(exc))}
@@ -981,6 +988,8 @@ def target_enroll(plan: dict[str, Any], idempotencyKey: str) -> dict[str, Any]:
typed_plan = EnrollmentPlanV1.model_validate(plan)
with Session(engine) as session:
return _json(EnrollmentPlane().enroll(session, typed_plan, idempotency_key=idempotencyKey))
except ValidationError:
return {"status": "invalid", "executed": False, "reason": "invalid_typed_plan"}
except (ValueError, EnrollmentError) as exc:
return {"status": "invalid", "executed": False, "reason": redact_message(str(exc))}
finally:
@@ -1015,6 +1024,9 @@ def deployment_apply(plan: dict[str, Any], idempotencyKey: str) -> dict[str, Any
operation="apply",
)
)
except ValidationError:
# Pydantic errors may contain arbitrary keys, input values and validator context.
return {"status": "invalid", "executed": False, "reason": "invalid_typed_plan"}
except (ValueError, DeploymentControlError) as exc:
return {"status": "invalid", "executed": False, "reason": redact_message(str(exc))}
finally:
@@ -1063,6 +1075,9 @@ def deployment_rollback(plan: dict[str, Any], idempotencyKey: str) -> dict[str,
operation="rollback",
)
)
except ValidationError:
# Pydantic errors may contain arbitrary keys, input values and validator context.
return {"status": "invalid", "executed": False, "reason": "invalid_typed_plan"}
except (ValueError, DeploymentControlError) as exc:
return {"status": "invalid", "executed": False, "reason": redact_message(str(exc))}
finally: