refactor: write DOKKU_SCALE contents to scale property
- remove extraction of DOKKU_SCALE - migrate to property system - rewrite internals to use a FormationSlice instead of a map
This commit is contained in:
1 parent
8fc0cb67ec
commit
401683a305
6 files changed
+105
-192
No files matched your search
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
dockeroptions "github.com/dokku/dokku/plugins/docker-options"
|
||||
|
||||
@@ -120,24 +121,15 @@ func CommandScale(appName string, skipDeploy bool, processTuples []string) error
|
||||
return err
|
||||
}
|
||||
|
||||
procfilePath := getProcfilePath(appName)
|
||||
if !hasScaleFile(appName) || common.FileExists(procfilePath) {
|
||||
update := func() error {
|
||||
return updateScalefile(appName, false, make(map[string]int))
|
||||
}
|
||||
if err := common.SuppressOutput(update); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(processTuples) == 0 {
|
||||
return scaleReport(appName)
|
||||
}
|
||||
|
||||
if !canScaleApp(appName) {
|
||||
return fmt.Errorf("App %s contains DOKKU_SCALE file and cannot be manually scaled", appName)
|
||||
return fmt.Errorf("App %s contains an app.json file with a formations key and cannot be manually scaled", appName)
|
||||
}
|
||||
|
||||
common.LogInfo1(fmt.Sprintf("Scaling %s processes: %s", appName, strings.Join(processTuples, " ")))
|
||||
return scaleSet(appName, skipDeploy, false, processTuples)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user