refactor: use CallPlugnTrigger instead of PlugnTriggerOutput

Refs #6422
This commit is contained in:
Jose Diaz-Gonzalez
2024-03-14 01:18:28 -04:00
parent a9933c7f02
commit cdff4ae867
15 changed files with 149 additions and 58 deletions

View File

@@ -40,8 +40,11 @@ func reportComputedStack(appName string) string {
return stack
}
b, _ := common.PlugnTriggerOutput("config-get", []string{appName, "DOKKU_IMAGE"}...)
if dokkuImage := strings.TrimSpace(string(b[:])); dokkuImage != "" {
results, _ := common.CallPlugnTrigger(common.PlugnTriggerInput{
Trigger: "config-get",
Args: []string{appName, "DOKKU_IMAGE"},
})
if dokkuImage := results.StdoutContents(); dokkuImage != "" {
common.LogWarn("Deprecated: use buildpacks:set-property instead of specifying DOKKU_IMAGE environment variable")
return dokkuImage
}

View File

@@ -5,7 +5,6 @@ import (
"fmt"
"os"
"path/filepath"
"strings"
"github.com/dokku/dokku/plugins/common"
)
@@ -22,8 +21,11 @@ func TriggerBuildpackStackName(appName string) error {
return nil
}
b, _ := common.PlugnTriggerOutput("config-get", []string{appName, "DOKKU_IMAGE"}...)
dokkuImage := strings.TrimSpace(string(b[:]))
results, _ := common.CallPlugnTrigger(common.PlugnTriggerInput{
Trigger: "config-get",
Args: []string{appName, "DOKKU_IMAGE"},
})
dokkuImage := results.StdoutContents()
if dokkuImage != "" {
common.LogWarn("Deprecated: use buildpacks:set-property instead of specifying DOKKU_IMAGE environment variable")
fmt.Println(dokkuImage)