mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
Starting a Controller script writes its env file every time and rejects unknown parameters
The upgrade service reads BRANCH from /tmp/wrolpi-upgrade.env, which upgrade.sh removes when it finishes. The
Controller wrote that file only when a request had parameters, so starting an upgrade without a branch (the simple UI
sends no body when the field is empty) left the service unable to start, while the API answered success. A request
like {"branch": "master"} was accepted with the key ignored, the same way.
Now the env file is always written, and a missing branch is the current one, as upgrade.sh chooses; a file left by an
interrupted run no longer chooses it. Unknown parameters and unknown request keys are errors.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
eb82489426
commit
3e54731534
4 changed files with 74 additions and 8 deletions
|
|
@ -4,7 +4,7 @@ Pydantic models for Controller API requests and responses.
|
|||
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
# ============================================================================
|
||||
|
|
@ -495,6 +495,9 @@ class ScriptOutputResponse(BaseModel):
|
|||
class ScriptStartRequest(BaseModel):
|
||||
"""Request model for starting a script."""
|
||||
|
||||
# Parameters belong in `params`; any other key is a mistake, not something to ignore.
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
params: Optional[dict[str, str]] = Field(default=None, description="Parameter values (e.g., {'branch': 'release'})")
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue