refactor: use ps-current-scale instead of parsing DOKKU_SCALE file when iterating over deployed processes

This commit is contained in:
Jose Diaz-Gonzalez committed 2021-08-01 01:43:35 -04:00
1 parent c62bff3002
commit 213f7d224c
9 files changed
+67 -29

No files matched your search

+16
View File
@@ -5,6 +5,7 @@ import (
"os"
"path"
"path/filepath"
"sort"
"strings"
sh "github.com/codeskyblue/go-sh"
@@ -263,3 +264,18 @@ func TriggerProcfileGetCommand(appName string, processType string, port int) err
func TriggerProcfileRemove(appName string) error {
return removeProcfile(appName)
}
// TriggerPsCurrentScale prints out the current scale contents (process-type=quantity) delimited by newlines
func TriggerPsCurrentScale(appName string) error {
formations, err := getFormations(appName)
if err != nil {
return err
}
sort.Sort(formations)
for _, formation := range formations {
fmt.Printf("%s=%d\n", formation.ProcessType, formation.Quantity)
}
return nil
}