refactor: use CallPlugnTrigger instead of PlugnTriggerOutput
Refs #6422
This commit is contained in:
@@ -69,15 +69,21 @@ func getRestartPolicy(appName string) (string, error) {
|
||||
|
||||
func getProcessCount(appName string) (int, error) {
|
||||
scheduler := common.GetAppScheduler(appName)
|
||||
b, _ := common.PlugnTriggerOutput("scheduler-app-status", []string{scheduler, appName}...)
|
||||
count := strings.Split(strings.TrimSpace(string(b[:])), " ")[0]
|
||||
results, _ := common.CallPlugnTrigger(common.PlugnTriggerInput{
|
||||
Trigger: "scheduler-app-status",
|
||||
Args: []string{scheduler, appName},
|
||||
})
|
||||
count := strings.Split(results.StdoutContents(), " ")[0]
|
||||
return strconv.Atoi(count)
|
||||
}
|
||||
|
||||
func getRunningState(appName string) string {
|
||||
scheduler := common.GetAppScheduler(appName)
|
||||
b, _ := common.PlugnTriggerOutput("scheduler-app-status", []string{scheduler, appName}...)
|
||||
return strings.Split(strings.TrimSpace(string(b[:])), " ")[1]
|
||||
results, _ := common.CallPlugnTrigger(common.PlugnTriggerInput{
|
||||
Trigger: "scheduler-app-status",
|
||||
Args: []string{scheduler, appName},
|
||||
})
|
||||
return strings.Split(results.StdoutContents(), " ")[1]
|
||||
}
|
||||
|
||||
func hasProcfile(appName string) bool {
|
||||
|
||||
@@ -2,7 +2,6 @@ package ps
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/dokku/dokku/plugins/common"
|
||||
)
|
||||
@@ -129,8 +128,11 @@ func Restore(appName string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
b, _ := common.PlugnTriggerOutput("config-get", []string{appName, "DOKKU_APP_RESTORE"}...)
|
||||
restore := strings.TrimSpace(string(b[:]))
|
||||
results, _ := common.CallPlugnTrigger(common.PlugnTriggerInput{
|
||||
Trigger: "config-get",
|
||||
Args: []string{appName, "DOKKU_APP_RESTORE"},
|
||||
})
|
||||
restore := results.StdoutContents()
|
||||
if restore == "0" {
|
||||
common.LogWarn(fmt.Sprintf("Skipping ps:restore for %s as DOKKU_APP_RESTORE=%s", appName, restore))
|
||||
return nil
|
||||
|
||||
@@ -129,8 +129,11 @@ func reportRestartPolicy(appName string) string {
|
||||
}
|
||||
|
||||
func reportRestore(appName string) string {
|
||||
b, _ := common.PlugnTriggerOutput("config-get", []string{appName, "DOKKU_APP_RESTORE"}...)
|
||||
restore := strings.TrimSpace(string(b[:]))
|
||||
results, _ := common.CallPlugnTrigger(common.PlugnTriggerInput{
|
||||
Trigger: "config-get",
|
||||
Args: []string{appName, "DOKKU_APP_RESTORE"},
|
||||
})
|
||||
restore := results.StdoutContents()
|
||||
if restore == "0" {
|
||||
restore = "false"
|
||||
} else {
|
||||
|
||||
@@ -72,8 +72,11 @@ func TriggerCorePostExtract(appName string, sourceWorkDir string) error {
|
||||
}
|
||||
|
||||
processSpecificProcfile := fmt.Sprintf("%s.%s", existingProcfile, os.Getenv("DOKKU_PID"))
|
||||
b, _ := common.PlugnTriggerOutput("git-get-property", []string{appName, "source-image"}...)
|
||||
appSourceImage := strings.TrimSpace(string(b[:]))
|
||||
results, _ := common.CallPlugnTrigger(common.PlugnTriggerInput{
|
||||
Trigger: "git-get-property",
|
||||
Args: []string{appName, "source-image"},
|
||||
})
|
||||
appSourceImage := results.StdoutContents()
|
||||
|
||||
repoDefaultProcfilePath := path.Join(sourceWorkDir, "Procfile")
|
||||
if appSourceImage == "" {
|
||||
|
||||
Reference in New Issue
Block a user