diff --git a/plugins/ps/functions.go b/plugins/ps/functions.go index 36810de03..67d0f871c 100644 --- a/plugins/ps/functions.go +++ b/plugins/ps/functions.go @@ -152,6 +152,13 @@ func getRestartPolicy(appName string) (string, error) { return "", nil } +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] + return strconv.Atoi(count) +} + func getRunningState(appName string) string { scheduler := common.GetAppScheduler(appName) b, _ := common.PlugnTriggerOutput("scheduler-app-status", []string{scheduler, appName}...) diff --git a/plugins/ps/ps.go b/plugins/ps/ps.go index 201fcad88..9c9b9f012 100644 --- a/plugins/ps/ps.go +++ b/plugins/ps/ps.go @@ -2,6 +2,8 @@ package ps import ( "fmt" + "strconv" + "strings" "github.com/dokku/dokku/plugins/common" ) @@ -72,7 +74,37 @@ func ReportSingleApp(appName, infoFlag string) error { policy = DefaultProperties["restart-policy"] } + canScale := "false" + if canScaleApp(appName) { + canScale = "true" + } + + deployed := "false" + if common.IsDeployed(appName) { + deployed = "true" + } + + runningState := getRunningState(appName) + + count, err := getProcessCount(appName) + if err != nil { + count = -1 + } + + b, _ := common.PlugnTriggerOutput("config-get", []string{appName, "DOKKU_APP_RESTORE"}...) + restore := strings.TrimSpace(string(b[:])) + if restore == "0" { + restore = "false" + } else { + restore = "true" + } + infoFlags := map[string]string{ + "--processes": strconv.Itoa(count), + "--running": runningState, + "--restore": restore, + "--deployed": deployed, + "--ps-can-scale": canScale, "--ps-restart-policy": policy, }