fix: treat empty ps restart-policy as an unset
`dokku ps:set <app> restart-policy` with no value erroneously returned `Invalid restart-policy specified` instead of unsetting the property like every other ps property. The restart policy is now managed as a normal app and global property surfaced through the `--ps-restart-policy`, `--ps-global-restart-policy`, and `--ps-computed-restart-policy` report flags, with the effective value applied at deploy time and existing values migrated on install. Because it is no longer stored as a Docker option it no longer appears in `docker-options:report`, and `--ps-restart-policy` now reports the raw value with the `on-failure:10` default available via `--ps-computed-restart-policy`.
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/dokku/dokku/plugins/common"
|
||||
dockeroptions "github.com/dokku/dokku/plugins/docker-options"
|
||||
"github.com/gofrs/flock"
|
||||
)
|
||||
|
||||
@@ -184,13 +183,8 @@ func CommandScale(appName string, skipDeploy bool, processTuples []string) error
|
||||
|
||||
// CommandSet sets or clears a ps property for an app
|
||||
func CommandSet(appName string, property string, value string) error {
|
||||
if property == "restart-policy" {
|
||||
if !isValidRestartPolicy(value) {
|
||||
return errors.New("Invalid restart-policy specified")
|
||||
}
|
||||
|
||||
common.LogInfo2Quiet(fmt.Sprintf("Setting %s to %s", property, value))
|
||||
return dockeroptions.SetDockerOptionForPhases(appName, []string{"deploy"}, "restart", value)
|
||||
if property == "restart-policy" && value != "" && !isValidRestartPolicy(value) {
|
||||
return errors.New("Invalid restart-policy specified")
|
||||
}
|
||||
|
||||
common.CommandPropertySet("ps", appName, property, value, DefaultProperties, GlobalProperties)
|
||||
|
||||
Reference in New Issue
Block a user