From d243433625f9cd535877efeec10c53f92e6f82c9 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Fri, 29 Jul 2022 22:44:23 -0400 Subject: [PATCH 1/2] fix: add support for --global as app name when calling config-get trigger The trigger in use _should_ be config-get-global, but some calling code does not check, so adding support here will ensure the calling code gets what it expects. Refs #5269 --- plugins/config/src/triggers/triggers.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/config/src/triggers/triggers.go b/plugins/config/src/triggers/triggers.go index 814c2e83f..eec123a48 100644 --- a/plugins/config/src/triggers/triggers.go +++ b/plugins/config/src/triggers/triggers.go @@ -14,6 +14,7 @@ import ( func main() { parts := strings.Split(os.Args[0], "/") trigger := parts[len(parts)-1] + global := flag.Bool("global", false, "--global: Whether global or app-specific") flag.Parse() var err error @@ -27,6 +28,10 @@ func main() { case "config-get": appName := flag.Arg(0) key := flag.Arg(1) + if *global { + appName = "--global" + key = flag.Arg(0) + } err = config.TriggerConfigGet(appName, key) case "config-get-global": key := flag.Arg(0) From 652a9ec26cdcc818a0c9cf714535804952b198cc Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Fri, 29 Jul 2022 22:45:23 -0400 Subject: [PATCH 2/2] chore: switch to correct trigger when getting a global argument While both will now work, using the correct trigger will skip some extra logic. --- plugins/common/docker.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/common/docker.go b/plugins/common/docker.go index 50dcf8aff..95d1b2f0d 100644 --- a/plugins/common/docker.go +++ b/plugins/common/docker.go @@ -172,7 +172,14 @@ func DockerCleanup(appName string, forceCleanup bool) error { if !forceCleanup { skipCleanup := false if appName != "" { - b, _ := PlugnTriggerOutput("config-get", []string{appName, "DOKKU_SKIP_CLEANUP"}...) + triggerName := "config-get" + triggerArgs := []string{appName, "DOKKU_SKIP_CLEANUP"} + if appName == "--global" { + triggerName = "config-get-global" + triggerArgs = []string{"DOKKU_SKIP_CLEANUP"} + } + + b, _ := PlugnTriggerOutput(triggerName, triggerArgs...) output := strings.TrimSpace(string(b[:])) if output == "true" { skipCleanup = true