refactor: allow specifying clearExisting when calling ps-set-scale
This commit is contained in:
@@ -1833,7 +1833,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|||||||
|
|
||||||
- Description: Sets the scale for an app based on a specified formation (process-type=quantity). Any unspecified process types will be left as is.
|
- Description: Sets the scale for an app based on a specified formation (process-type=quantity). Any unspecified process types will be left as is.
|
||||||
- Invoked by:
|
- Invoked by:
|
||||||
- Arguments: `$APP $SKIP_DEPLOY [$PROCESS_TUPLE...]`
|
- Arguments: `$APP $SKIP_DEPLOY $CLEAR_EXISTING [$PROCESS_TUPLE...]`
|
||||||
- Example:
|
- Example:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
|||||||
@@ -496,7 +496,9 @@ func setScale(appName string, image string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
args := []string{appName, "true"}
|
skipDeploy := true
|
||||||
|
clearExisting := false
|
||||||
|
args := []string{appName, strconv.FormatBool(skipDeploy), strconv.FormatBool(clearExisting)}
|
||||||
for processType, formation := range appJSON.Formation {
|
for processType, formation := range appJSON.Formation {
|
||||||
args = append(args, fmt.Sprintf("%s=%d", processType, formation.Quantity))
|
args = append(args, fmt.Sprintf("%s=%d", processType, formation.Quantity))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,8 @@ func main() {
|
|||||||
appName := flag.Arg(0)
|
appName := flag.Arg(0)
|
||||||
appName, args := common.ShiftString(flag.Args())
|
appName, args := common.ShiftString(flag.Args())
|
||||||
skipDeploy, processTuples := common.ShiftString(args)
|
skipDeploy, processTuples := common.ShiftString(args)
|
||||||
err = ps.TriggerPsSetScale(appName, common.ToBool(skipDeploy), processTuples)
|
clearExisting, processTuples := common.ShiftString(args)
|
||||||
|
err = ps.TriggerPsSetScale(appName, common.ToBool(skipDeploy), common.ToBool(clearExisting), processTuples)
|
||||||
case "report":
|
case "report":
|
||||||
appName := flag.Arg(0)
|
appName := flag.Arg(0)
|
||||||
err = ps.ReportSingleApp(appName, "", "")
|
err = ps.ReportSingleApp(appName, "", "")
|
||||||
|
|||||||
@@ -315,6 +315,6 @@ func TriggerPsCurrentScale(appName string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TriggerPsSetScale configures the scale parameters for a given app
|
// TriggerPsSetScale configures the scale parameters for a given app
|
||||||
func TriggerPsSetScale(appName string, skipDeploy bool, processTuples []string) error {
|
func TriggerPsSetScale(appName string, skipDeploy bool, clearExisting bool, processTuples []string) error {
|
||||||
return scaleSet(appName, skipDeploy, true, processTuples)
|
return scaleSet(appName, skipDeploy, clearExisting, processTuples)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user