chore: remove all direct usage of go-sh outside of plugin trigger setup

The new way is to use CallExecCommand instead.
This commit is contained in:
Jose Diaz-Gonzalez
2024-02-12 19:28:23 -05:00
parent 688ee518af
commit 8a940c6e47
11 changed files with 99 additions and 99 deletions

View File

@@ -3,7 +3,6 @@ module github.com/dokku/dokku/plugins/logs
go 1.21
require (
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27
github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000
github.com/dokku/dokku/plugins/docker-options v0.0.0-00010101000000-000000000000
github.com/joncalhoun/qson v0.0.0-20200422171543-84433dcd3da0
@@ -13,6 +12,7 @@ require (
require (
github.com/alexellis/go-execute/v2 v2.2.1 // indirect
github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 // indirect
github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect

View File

@@ -10,8 +10,6 @@ import (
"github.com/dokku/dokku/plugins/common"
dockeroptions "github.com/dokku/dokku/plugins/docker-options"
sh "github.com/codeskyblue/go-sh"
)
// TriggerDockerArgsProcessDeploy outputs the logs plugin docker options for an app
@@ -47,9 +45,14 @@ func TriggerDockerArgsProcessDeploy(appName string) error {
}
if !hasDriverOpt {
b, _ := sh.Command(common.DockerBin(), "system", "info", "--format", "{{ .LoggingDriver }}").Output()
output := strings.TrimSpace(string(b[:]))
if !allowedDrivers[output] {
result, _ := common.CallExecCommand(common.ExecCommandInput{
Command: common.DockerBin(),
Args: []string{"system", "info", "--format", "{{ .LoggingDriver }}"},
CaptureOutput: true,
StreamStdio: false,
})
if !allowedDrivers[result.StdoutContents()] {
ignoreMaxSize = true
}
}