style: gofmt normalization — no logic changes
gofmt -w across the controller tree (46 files) so gofmt -l is empty — disarms the
formatting landmine where a targeted edit + accidental gofmt -w swept ~46 unrelated
files. Pure formatting: whitespace + gofmt's optional-semicolon removal in reflowed
inline closures. One doc comment reworded ('' -> 'the empty string') to avoid gofmt's
Go-1.19 doc-comment typographic substitition ('' -> curly quote) muddying its meaning.
No build/vet/test behavior change.
This commit is contained in:
@@ -765,6 +765,7 @@ func getMariaDBPassword(ctx context.Context, containerID string) string {
|
|||||||
// - else longest known prefix → handles <stack>_postgres / <stack>-1 / compose-suffixed names.
|
// - else longest known prefix → handles <stack>_postgres / <stack>-1 / compose-suffixed names.
|
||||||
// - else → candidate (fall back to today's suffix-strip; preserves behaviour when
|
// - else → candidate (fall back to today's suffix-strip; preserves behaviour when
|
||||||
// the stack list is empty/unavailable, so nothing regresses).
|
// the stack list is empty/unavailable, so nothing regresses).
|
||||||
|
//
|
||||||
// A nil/empty `known` map = the legacy fast path (pure suffix-strip).
|
// A nil/empty `known` map = the legacy fast path (pure suffix-strip).
|
||||||
func deriveStackName(containerName string, known map[string]bool) string {
|
func deriveStackName(containerName string, known map[string]bool) string {
|
||||||
candidate := suffixStripStackName(containerName)
|
candidate := suffixStripStackName(containerName)
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import (
|
|||||||
// RecoveryManifest describes an app's self-contained, SECRET-FREE recovery unit (Phase 2).
|
// RecoveryManifest describes an app's self-contained, SECRET-FREE recovery unit (Phase 2).
|
||||||
//
|
//
|
||||||
// The unit on a drive is `<nsRoot>/backups/primary/<app>/` and contains:
|
// The unit on a drive is `<nsRoot>/backups/primary/<app>/` and contains:
|
||||||
|
//
|
||||||
// compose/ docker-compose.yml + .felhom.yml + a SECRET-STRIPPED app.yaml
|
// compose/ docker-compose.yml + .felhom.yml + a SECRET-STRIPPED app.yaml
|
||||||
// db-dumps/ app-consistent DB dump(s) (written by the dump flow)
|
// db-dumps/ app-consistent DB dump(s) (written by the dump flow)
|
||||||
// volume-dumps/ named-volume tars (written by the dump flow)
|
// volume-dumps/ named-volume tars (written by the dump flow)
|
||||||
|
|||||||
@@ -187,10 +187,12 @@ func (m *Manager) tier2FitsSystemDrive(sys string, unitSizeBytes int64) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Tier-2 v2 layout (Task 3b, architecture §8): backups/secondary/<stack>/ holds
|
// Tier-2 v2 layout (Task 3b, architecture §8): backups/secondary/<stack>/ holds
|
||||||
|
//
|
||||||
// .felhom-tier2-layout (marker file, content "2" — written LAST, after all legs + reconcile)
|
// .felhom-tier2-layout (marker file, content "2" — written LAST, after all legs + reconcile)
|
||||||
// recovery-unit/ (the unit leg, layout-identical to v1)
|
// recovery-unit/ (the unit leg, layout-identical to v1)
|
||||||
// hdd/<relpath>/ (per-bind HDD legs, relpath-mirroring)
|
// hdd/<relpath>/ (per-bind HDD legs, relpath-mirroring)
|
||||||
// userdata/<relpath>/ (per-bind USERDATA legs)
|
// userdata/<relpath>/ (per-bind USERDATA legs)
|
||||||
|
//
|
||||||
// Relpath-mirroring represents N>1 dirs + nested binds natively (the v1 flat-appdata N>1 refusal is
|
// Relpath-mirroring represents N>1 dirs + nested binds natively (the v1 flat-appdata N>1 refusal is
|
||||||
// lifted structurally) and makes restore position-derivable (dest relpath → live path under the app's
|
// lifted structurally) and makes restore position-derivable (dest relpath → live path under the app's
|
||||||
// current HDD_PATH). The whole tree is DERIVED from live data — migration is delete-and-rebuild.
|
// current HDD_PATH). The whole tree is DERIVED from live data — migration is delete-and-rebuild.
|
||||||
|
|||||||
@@ -101,7 +101,12 @@ func (m *Manager) OnStackStart(_ context.Context, stackName string) {
|
|||||||
provStack, pOk := m.stacks.GetStack(provider)
|
provStack, pOk := m.stacks.GetStack(provider)
|
||||||
if !pOk || !provStack.Deployed || !isStackUp(provStack.State) {
|
if !pOk || !provStack.Deployed || !isStackUp(provStack.State) {
|
||||||
if m.isDebug() {
|
if m.isDebug() {
|
||||||
m.logger.Printf("[DEBUG] [integrations] OnStackStart: skipping %s — provider %s not up (found=%v deployed=%v state=%v)", key, provider, pOk, pOk && provStack.Deployed, func() stacks.ContainerState { if pOk { return provStack.State }; return "" }())
|
m.logger.Printf("[DEBUG] [integrations] OnStackStart: skipping %s — provider %s not up (found=%v deployed=%v state=%v)", key, provider, pOk, pOk && provStack.Deployed, func() stacks.ContainerState {
|
||||||
|
if pOk {
|
||||||
|
return provStack.State
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}())
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -109,7 +114,12 @@ func (m *Manager) OnStackStart(_ context.Context, stackName string) {
|
|||||||
tgtStack, tOk := m.stacks.GetStack(target)
|
tgtStack, tOk := m.stacks.GetStack(target)
|
||||||
if !tOk || !tgtStack.Deployed || !isStackUp(tgtStack.State) {
|
if !tOk || !tgtStack.Deployed || !isStackUp(tgtStack.State) {
|
||||||
if m.isDebug() {
|
if m.isDebug() {
|
||||||
m.logger.Printf("[DEBUG] [integrations] OnStackStart: skipping %s — target %s not up (found=%v deployed=%v state=%v)", key, target, tOk, tOk && tgtStack.Deployed, func() stacks.ContainerState { if tOk { return tgtStack.State }; return "" }())
|
m.logger.Printf("[DEBUG] [integrations] OnStackStart: skipping %s — target %s not up (found=%v deployed=%v state=%v)", key, target, tOk, tOk && tgtStack.Deployed, func() stacks.ContainerState {
|
||||||
|
if tOk {
|
||||||
|
return tgtStack.State
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}())
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,12 @@ func (m *Manager) Toggle(ctx context.Context, provider, target string, enable bo
|
|||||||
// Validate: provider must be deployed and running
|
// Validate: provider must be deployed and running
|
||||||
provStack, pOk := m.stacks.GetStack(provider)
|
provStack, pOk := m.stacks.GetStack(provider)
|
||||||
if m.isDebug() {
|
if m.isDebug() {
|
||||||
m.logger.Printf("[DEBUG] [integrations] Toggle: provider %s found=%v deployed=%v state=%v", provider, pOk, pOk && provStack.Deployed, func() stacks.ContainerState { if pOk { return provStack.State }; return "" }())
|
m.logger.Printf("[DEBUG] [integrations] Toggle: provider %s found=%v deployed=%v state=%v", provider, pOk, pOk && provStack.Deployed, func() stacks.ContainerState {
|
||||||
|
if pOk {
|
||||||
|
return provStack.State
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}())
|
||||||
}
|
}
|
||||||
if !pOk || !provStack.Deployed {
|
if !pOk || !provStack.Deployed {
|
||||||
return state, fmt.Errorf("a szolgáltató alkalmazás (%s) nincs telepítve", provider)
|
return state, fmt.Errorf("a szolgáltató alkalmazás (%s) nincs telepítve", provider)
|
||||||
@@ -113,7 +118,12 @@ func (m *Manager) Toggle(ctx context.Context, provider, target string, enable bo
|
|||||||
if target != "filebrowser" {
|
if target != "filebrowser" {
|
||||||
tgtStack, tOk := m.stacks.GetStack(target)
|
tgtStack, tOk := m.stacks.GetStack(target)
|
||||||
if m.isDebug() {
|
if m.isDebug() {
|
||||||
m.logger.Printf("[DEBUG] [integrations] Toggle: target %s found=%v deployed=%v state=%v", target, tOk, tOk && tgtStack.Deployed, func() stacks.ContainerState { if tOk { return tgtStack.State }; return "" }())
|
m.logger.Printf("[DEBUG] [integrations] Toggle: target %s found=%v deployed=%v state=%v", target, tOk, tOk && tgtStack.Deployed, func() stacks.ContainerState {
|
||||||
|
if tOk {
|
||||||
|
return tgtStack.State
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}())
|
||||||
}
|
}
|
||||||
if !tOk || !tgtStack.Deployed {
|
if !tOk || !tgtStack.Deployed {
|
||||||
return state, fmt.Errorf("a célalkalmazás (%s) nincs telepítve", target)
|
return state, fmt.Errorf("a célalkalmazás (%s) nincs telepítve", target)
|
||||||
|
|||||||
@@ -321,4 +321,3 @@ func buildStacksReport(stackMgr *stacks.Manager) StacksReport {
|
|||||||
|
|
||||||
return sr
|
return sr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -842,4 +842,3 @@ var runCommandStdin = func(stdin, name string, args ...string) (string, error) {
|
|||||||
err := cmd.Run()
|
err := cmd.Run()
|
||||||
return out.String(), err
|
return out.String(), err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,8 +59,8 @@ func TestAppExportDomainUsesCustomerDomainNotCSRFToken(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The empty-subdomain branch still yields '' — an app without a subdomain must not get a link to
|
// The empty-subdomain branch still yields the empty string — an app without a subdomain must not get
|
||||||
// a bare domain (the truthiness guard is what produces that, and the fix must not disturb it).
|
// a link to a bare domain (the truthiness guard is what produces that, and the fix must not disturb it).
|
||||||
func TestAppExportDomainEmptyWithoutSubdomain(t *testing.T) {
|
func TestAppExportDomainEmptyWithoutSubdomain(t *testing.T) {
|
||||||
line := exportScriptLine(t, renderExport(t, ""))
|
line := exportScriptLine(t, renderExport(t, ""))
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,9 @@ func (p *fabWebProvider) GetStackDir(string) (string, bool) { return p.stackDir,
|
|||||||
func (p *fabWebProvider) GetStackComposePath(string) (string, bool) {
|
func (p *fabWebProvider) GetStackComposePath(string) (string, bool) {
|
||||||
return filepath.Join(p.stackDir, "docker-compose.yml"), true
|
return filepath.Join(p.stackDir, "docker-compose.yml"), true
|
||||||
}
|
}
|
||||||
func (p *fabWebProvider) GetStackHDDMounts(string) []string { return []string{appbackup.UserdataDir(p.hddPath)} }
|
func (p *fabWebProvider) GetStackHDDMounts(string) []string {
|
||||||
|
return []string{appbackup.UserdataDir(p.hddPath)}
|
||||||
|
}
|
||||||
func (p *fabWebProvider) GetStackHDDPath(string) string { return p.hddPath }
|
func (p *fabWebProvider) GetStackHDDPath(string) string { return p.hddPath }
|
||||||
func (p *fabWebProvider) GetStackClassifiedBinds(string) ([]appbackup.ClassifiedBind, bool) {
|
func (p *fabWebProvider) GetStackClassifiedBinds(string) ([]appbackup.ClassifiedBind, bool) {
|
||||||
return p.binds, true
|
return p.binds, true
|
||||||
|
|||||||
@@ -49,7 +49,10 @@ func TestNetAddGate_OldAgent_RefusedUpFront(t *testing.T) {
|
|||||||
verifyErr: &agentapi.StatusError{Path: "/netstorage/verify-status", Code: http.StatusNotFound},
|
verifyErr: &agentapi.StatusError{Path: "/netstorage/verify-status", Code: http.StatusNotFound},
|
||||||
}
|
}
|
||||||
s.netAgentFn = func() (netAgent, error) { return agent, nil }
|
s.netAgentFn = func() (netAgent, error) { return agent, nil }
|
||||||
s.netProbeFn = func(context.Context, string) probeOutcome { t.Error("probe must never run on a gated add"); return probeOutcome{} }
|
s.netProbeFn = func(context.Context, string) probeOutcome {
|
||||||
|
t.Error("probe must never run on a gated add")
|
||||||
|
return probeOutcome{}
|
||||||
|
}
|
||||||
|
|
||||||
w := postNetAdd(t, s, "media")
|
w := postNetAdd(t, s, "media")
|
||||||
if w.Code != http.StatusPreconditionFailed {
|
if w.Code != http.StatusPreconditionFailed {
|
||||||
|
|||||||
@@ -221,6 +221,7 @@ func TestRunStorageInit_Success(t *testing.T) {
|
|||||||
|
|
||||||
// F6 (VALIDATION-n100) — initialize must end in a USABLE (mounted+registered) drive even when the
|
// F6 (VALIDATION-n100) — initialize must end in a USABLE (mounted+registered) drive even when the
|
||||||
// client disconnects mid-format. Two halves:
|
// client disconnects mid-format. Two halves:
|
||||||
|
//
|
||||||
// RED-PROOF: runStorageInit on a CANCELLED context (the disconnect) aborts at the mount step →
|
// RED-PROOF: runStorageInit on a CANCELLED context (the disconnect) aborts at the mount step →
|
||||||
// the device is formatted but NOT registered (the N100-observed state). This is exactly what
|
// the device is formatted but NOT registered (the N100-observed state). This is exactly what
|
||||||
// the pre-fix handler did (it ran the chain on r.Context()).
|
// the pre-fix handler did (it ran the chain on r.Context()).
|
||||||
|
|||||||
Reference in New Issue
Block a user