diff --git a/plugins/ps/functions.go b/plugins/ps/functions.go index f47bb9c64..b318c86df 100644 --- a/plugins/ps/functions.go +++ b/plugins/ps/functions.go @@ -16,7 +16,8 @@ import ( ) func canScaleApp(appName string) bool { - return !common.FileExists(getScalefileExtractedPath(appName)) + canScale := common.PropertyGetDefault("ps", appName, "can-scale", "true") + return common.ToBool(canScale) } func extractProcfile(appName, image string) error { diff --git a/plugins/ps/src/triggers/triggers.go b/plugins/ps/src/triggers/triggers.go index e3a365fbd..bad436b7b 100644 --- a/plugins/ps/src/triggers/triggers.go +++ b/plugins/ps/src/triggers/triggers.go @@ -75,14 +75,18 @@ func main() { case "procfile-remove": appName := flag.Arg(0) err = ps.TriggerProcfileRemove(appName) + case "ps-can-scale": + appName := flag.Arg(0) + canScale := common.ToBool(flag.Arg(1)) + err = ps.TriggerPsCanScale(appName, canScale) + case "ps-current-scale": + appName := flag.Arg(0) + err = ps.TriggerPsCurrentScale(appName) case "ps-set-scale": appName := flag.Arg(0) appName, args := common.ShiftString(flag.Args()) skipDeploy, processTuples := common.ShiftString(args) err = ps.TriggerPsSetScale(appName, common.ToBool(skipDeploy), processTuples) - case "ps-current-scale": - appName := flag.Arg(0) - err = ps.TriggerPsCurrentScale(appName) case "report": appName := flag.Arg(0) err = ps.ReportSingleApp(appName, "", "") diff --git a/plugins/ps/triggers.go b/plugins/ps/triggers.go index e152e447d..9de576f28 100644 --- a/plugins/ps/triggers.go +++ b/plugins/ps/triggers.go @@ -6,6 +6,7 @@ import ( "path" "path/filepath" "sort" + "strconv" "strings" sh "github.com/codeskyblue/go-sh" @@ -265,6 +266,11 @@ func TriggerProcfileRemove(appName string) error { return removeProcfile(appName) } +// TriggerPsCanScale sets whether or not a user can scale an app with ps:scale +func TriggerPsCanScale(appName string, canScale bool) error { + return common.PropertyWrite("ps", appName, "can-scale", strconv.FormatBool(canScale)) +} + // TriggerPsCurrentScale prints out the current scale contents (process-type=quantity) delimited by newlines func TriggerPsCurrentScale(appName string) error { formations, err := getFormations(appName)