43e99d160c
gates / gates (push) Successful in 26s
An install over an app's kept drive folder (appdata/<app> non-empty) asks the household: "use my kept data" (a load from the newest copy of THIS drive's install, own unit or second-drive mirror, then the template's after_load) or "start fresh" (the folder is renamed into <drive>/kept/<app>/<date>/ with the removed app's unit; nothing deleted). The install API answers 409 kept_data_choice until one is chosen; DeployStack refuses too. New page Megorzott adatok / Kept data (/kept-data): Load / Look / Delete (typed confirmation, the only deletion of kept data). FileBrowser gets a read-only source. The drive-full warning names the kept folders. <drive>/kept is protected and outside every backup leg. R-690: the removed-app restore (R-487) never found a unit on a DATA drive — it asked GetStackComposePath (true for every catalog app) and restored nextcloud with no env. Now isStackDeployed; pinned with a production-shaped provider. Red-proofs: audits/night-2026-09-26/E/redproofs/. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
53 lines
2.7 KiB
Go
53 lines
2.7 KiB
Go
package stacks
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"gitea.dooplex.hu/admin/felhom-controller/internal/i18n"
|
|
)
|
|
|
|
// R-553 — the deploy path's refusals carry a KIND, so the API can pick its status code without
|
|
// reading the customer's Hungarian sentence. The sentences themselves are unchanged (a test pins
|
|
// each one byte-for-byte); `internal/util.KindErrorf` builds the message exactly as fmt.Errorf did.
|
|
//
|
|
// Before this, internal/api/router.go matched „kötelező", „memória", "does not exist" and
|
|
// "already deployed" in the error text — so localisation slice 2 would have turned every validation
|
|
// refusal into a 500.
|
|
var (
|
|
// ErrAlreadyDeployed — the stack is already deployed (API: 409).
|
|
ErrAlreadyDeployed = errors.New("stack already deployed")
|
|
// ErrRequiredField — a required (or password) field was left empty (API: 400).
|
|
ErrRequiredField = errors.New("required field empty")
|
|
// ErrPathMissing — a path field names something that is not on the filesystem (API: 400).
|
|
ErrPathMissing = errors.New("path field does not exist")
|
|
// ErrNotEnoughMemory — the memory verdict refused the deploy (API: 400).
|
|
ErrNotEnoughMemory = errors.New("not enough memory")
|
|
// ErrKeptDataChoice — the app's drive folder already holds old data and the install named neither
|
|
// „use my kept data" nor „start fresh" (`09` §3 decision 36; API: 409 with code kept_data_choice).
|
|
ErrKeptDataChoice = errors.New("kept data: a choice is needed")
|
|
// ErrStackDeploying — R-634 (v0.265.0): a stop or start was asked of a stack whose deploy is still
|
|
// running. Refused, because a `compose down` or a second `compose up -d` in the middle of the
|
|
// deploy's own `up` makes BOTH fail, and the deploy then records „not deployed" over whatever
|
|
// containers the race left behind. Pinned by TestR634_StopAndStartRefuseADeployingStack.
|
|
ErrStackDeploying = errors.New("stack is being deployed")
|
|
)
|
|
|
|
// msgHU renders a bundle message in Hungarian.
|
|
//
|
|
// It exists for the few strings this package returns as TEXT rather than as an error — the soft
|
|
// overcommit warning is the only one today. Those are display strings with no error to carry a key,
|
|
// so the copy lives in the bundle (a translator sees it, and scripts/i18n_go_parity.py pins it) while
|
|
// the value handed back is still Hungarian. **The consequence, stated rather than hidden: such a
|
|
// string renders Hungarian on an English page.** Filed as R-575; the fix is for the caller to carry
|
|
// the key the way Alert and UpdateRefusal do, not for this helper to guess a language it cannot know.
|
|
func msgHU(key string, args ...interface{}) string {
|
|
b, err := i18n.Shared()
|
|
if err != nil {
|
|
return key
|
|
}
|
|
if len(args) == 0 {
|
|
return b.Msg(i18n.Default, key)
|
|
}
|
|
return b.Msgf(i18n.Default, key, args...)
|
|
}
|