M19: deriveStackName cross-references deployed stacks (fix DB-container misattribution)
deriveStackName pure-suffix-stripped on '-' (postgres/db/mariadb/.../cache), so a stack whose slug ENDS in a role token (e.g. 'my-cache') was misattributed (stripped to 'my') — filing its DB dump under the wrong/nonexistent stack. Now threads the set of deployed stack names (m.knownStackNames() <- ListDeployedStacks) into DiscoverDatabases and cross-references: candidate suffix-strip if known, else the container name if it IS a known stack, else longest known stack that is a prefix (handles <stack>_postgres / <stack>-1), else legacy strip. nil/empty known = legacy behaviour (appexport passes nil). Table test incl. the my-cache case (fails pre-fix).
This commit is contained in:
@@ -41,7 +41,7 @@ func (m *Manager) reimportDBDumps(ctx context.Context, stackName, nsRoot string)
|
||||
discover := m.discoverDBs
|
||||
if discover == nil {
|
||||
discover = func(ctx context.Context) ([]DiscoveredDB, error) {
|
||||
return DiscoverDatabases(ctx, m.logger, m.isDebug())
|
||||
return DiscoverDatabases(ctx, m.logger, m.isDebug(), m.knownStackNames())
|
||||
}
|
||||
}
|
||||
imp := m.importDBDump
|
||||
|
||||
Reference in New Issue
Block a user