From 5286612618ce2d0606cc94e2791504ea05120638 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 24 May 2026 01:40:39 -0400 Subject: [PATCH] fix: respond to pr comments --- plugins/docker-options/functions.go | 25 +++++-------------------- plugins/docker-options/triggers.go | 1 - tests/unit/docker-options-2.bats | 1 - 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/plugins/docker-options/functions.go b/plugins/docker-options/functions.go index a04c985cd..fec61a67f 100644 --- a/plugins/docker-options/functions.go +++ b/plugins/docker-options/functions.go @@ -278,13 +278,14 @@ func convertLegacyMigratedMarker(appName, phase string) error { // previous release - who have `migrated-from-files` set AND `.migrated` // files on disk - still get those files drained into properties. func migrateLegacyDockerOptionsFiles() error { + if common.PropertyGet("docker-options", "--global", "migrated-from-files") == "true" { + return nil + } + apps, err := common.DokkuApps() if err != nil { if errors.Is(err, common.NoAppsExist) { - if !common.PropertyExists("docker-options", "--global", "migrated-from-files") { - return common.PropertyWrite("docker-options", "--global", "migrated-from-files", "true") - } - return nil + return common.PropertyWrite("docker-options", "--global", "migrated-from-files", "true") } return err } @@ -292,7 +293,6 @@ func migrateLegacyDockerOptionsFiles() error { // Upgrade-cycle conversion: drain any `.migrated` sentinels left // behind by the previous release into the new per-phase properties. // Always runs; cheap when nothing to do. - // TODO(post-deprecation): remove this loop. for _, appName := range apps { for _, phase := range availablePhases { if err := convertLegacyMigratedMarker(appName, phase); err != nil { @@ -301,10 +301,6 @@ func migrateLegacyDockerOptionsFiles() error { } } - if common.PropertyExists("docker-options", "--global", "migrated-from-files") { - return nil - } - for _, appName := range apps { for _, phase := range availablePhases { legacyPath := filepath.Join(common.AppRoot(appName), "DOCKER_OPTIONS_"+strings.ToUpper(phase)) @@ -355,14 +351,3 @@ func readLegacyOptionsFile(path string) ([]string, error) { } return lines, nil } - -// removeMigratedLegacyFiles deletes any leftover DOCKER_OPTIONS_*.migrated -// files for an app. Called from post-delete so we don't leak files into a -// directory that is about to be torn down anyway. -// TODO(post-deprecation): remove this helper and the call in TriggerPostDelete. -func removeMigratedLegacyFiles(appName string) { - for _, phase := range availablePhases { - path := filepath.Join(common.AppRoot(appName), "DOCKER_OPTIONS_"+strings.ToUpper(phase)+".migrated") - _ = os.Remove(path) - } -} diff --git a/plugins/docker-options/triggers.go b/plugins/docker-options/triggers.go index de9292454..936055b99 100644 --- a/plugins/docker-options/triggers.go +++ b/plugins/docker-options/triggers.go @@ -44,7 +44,6 @@ func TriggerPostDelete(appName string) error { if err := common.PropertyDestroy("docker-options", appName); err != nil { return err } - removeMigratedLegacyFiles(appName) return nil } diff --git a/tests/unit/docker-options-2.bats b/tests/unit/docker-options-2.bats index 9fe3678f6..f7f7f289f 100644 --- a/tests/unit/docker-options-2.bats +++ b/tests/unit/docker-options-2.bats @@ -264,4 +264,3 @@ web: python3 -u web.py worker: python3 -u worker.py EOF } -