mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Use "on-failure" for both containers and services
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
parent
6ec4a640de
commit
a859a33647
9 changed files with 12 additions and 11 deletions
|
@ -476,7 +476,7 @@ func addServiceFlags(cmd *cobra.Command, opts *serviceOptions) {
|
||||||
|
|
||||||
flags.Var(&opts.replicas, flagReplicas, "Number of tasks")
|
flags.Var(&opts.replicas, flagReplicas, "Number of tasks")
|
||||||
|
|
||||||
flags.StringVar(&opts.restartPolicy.condition, flagRestartCondition, "", "Restart when condition is met (none, on_failure, or any)")
|
flags.StringVar(&opts.restartPolicy.condition, flagRestartCondition, "", "Restart when condition is met (none, on-failure, or any)")
|
||||||
flags.Var(&opts.restartPolicy.delay, flagRestartDelay, "Delay between restart attempts")
|
flags.Var(&opts.restartPolicy.delay, flagRestartDelay, "Delay between restart attempts")
|
||||||
flags.Var(&opts.restartPolicy.maxAttempts, flagRestartMaxAttempts, "Maximum number of restarts before giving up")
|
flags.Var(&opts.restartPolicy.maxAttempts, flagRestartMaxAttempts, "Maximum number of restarts before giving up")
|
||||||
flags.Var(&opts.restartPolicy.window, flagRestartWindow, "Window used to evaluate the restart policy")
|
flags.Var(&opts.restartPolicy.window, flagRestartWindow, "Window used to evaluate the restart policy")
|
||||||
|
|
|
@ -1701,7 +1701,7 @@ _docker_service_update() {
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
--restart-condition)
|
--restart-condition)
|
||||||
COMPREPLY=( $( compgen -W "any none on_failure" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W "any none on-failure" -- "$cur" ) )
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
--user|-u)
|
--user|-u)
|
||||||
|
|
|
@ -1079,7 +1079,7 @@ __docker_service_subcommand() {
|
||||||
"($help)--replicas=[Number of tasks]:replicas: "
|
"($help)--replicas=[Number of tasks]:replicas: "
|
||||||
"($help)--reserve-cpu=[Reserve CPUs]:value: "
|
"($help)--reserve-cpu=[Reserve CPUs]:value: "
|
||||||
"($help)--reserve-memory=[Reserve Memory]:value: "
|
"($help)--reserve-memory=[Reserve Memory]:value: "
|
||||||
"($help)--restart-condition=[Restart when condition is met]:mode:(any none on_failure)"
|
"($help)--restart-condition=[Restart when condition is met]:mode:(any none on-failure)"
|
||||||
"($help)--restart-delay=[Delay between restart attempts]:delay: "
|
"($help)--restart-delay=[Delay between restart attempts]:delay: "
|
||||||
"($help)--restart-max-attempts=[Maximum number of restarts before giving up]:max-attempts: "
|
"($help)--restart-max-attempts=[Maximum number of restarts before giving up]:max-attempts: "
|
||||||
"($help)--restart-window=[Window used to evaluate the restart policy]:window: "
|
"($help)--restart-window=[Window used to evaluate the restart policy]:window: "
|
||||||
|
|
|
@ -219,7 +219,8 @@ func restartPolicyToGRPC(p *types.RestartPolicy) (*swarmapi.RestartPolicy, error
|
||||||
var rp *swarmapi.RestartPolicy
|
var rp *swarmapi.RestartPolicy
|
||||||
if p != nil {
|
if p != nil {
|
||||||
rp = &swarmapi.RestartPolicy{}
|
rp = &swarmapi.RestartPolicy{}
|
||||||
if condition, ok := swarmapi.RestartPolicy_RestartCondition_value[strings.ToUpper(string(p.Condition))]; ok {
|
sanatizedCondition := strings.ToUpper(strings.Replace(string(p.Condition), "-", "_", -1))
|
||||||
|
if condition, ok := swarmapi.RestartPolicy_RestartCondition_value[sanatizedCondition]; ok {
|
||||||
rp.Condition = swarmapi.RestartPolicy_RestartCondition(condition)
|
rp.Condition = swarmapi.RestartPolicy_RestartCondition(condition)
|
||||||
} else if string(p.Condition) == "" {
|
} else if string(p.Condition) == "" {
|
||||||
rp.Condition = swarmapi.RestartOnAny
|
rp.Condition = swarmapi.RestartOnAny
|
||||||
|
|
|
@ -4007,7 +4007,7 @@ JSON Parameters:
|
||||||
- **Memory** – Memory reservation
|
- **Memory** – Memory reservation
|
||||||
- **RestartPolicy** – Specification for the restart policy which applies to containers created
|
- **RestartPolicy** – Specification for the restart policy which applies to containers created
|
||||||
as part of this service.
|
as part of this service.
|
||||||
- **Condition** – Condition for restart (`none`, `on_failure`, or `any`).
|
- **Condition** – Condition for restart (`none`, `on-failure`, or `any`).
|
||||||
- **Delay** – Delay between restart attempts.
|
- **Delay** – Delay between restart attempts.
|
||||||
- **Attempts** – Maximum attempts to restart a given container before giving up (default value
|
- **Attempts** – Maximum attempts to restart a given container before giving up (default value
|
||||||
is 0, which is ignored).
|
is 0, which is ignored).
|
||||||
|
@ -4225,7 +4225,7 @@ Update the service `id`.
|
||||||
- **Memory** – Memory reservation
|
- **Memory** – Memory reservation
|
||||||
- **RestartPolicy** – Specification for the restart policy which applies to containers created
|
- **RestartPolicy** – Specification for the restart policy which applies to containers created
|
||||||
as part of this service.
|
as part of this service.
|
||||||
- **Condition** – Condition for restart (`none`, `on_failure`, or `any`).
|
- **Condition** – Condition for restart (`none`, `on-failure`, or `any`).
|
||||||
- **Delay** – Delay between restart attempts.
|
- **Delay** – Delay between restart attempts.
|
||||||
- **Attempts** – Maximum attempts to restart a given container before giving up (default value
|
- **Attempts** – Maximum attempts to restart a given container before giving up (default value
|
||||||
is 0, which is ignored).
|
is 0, which is ignored).
|
||||||
|
|
|
@ -4008,7 +4008,7 @@ JSON Parameters:
|
||||||
- **Memory** – Memory reservation
|
- **Memory** – Memory reservation
|
||||||
- **RestartPolicy** – Specification for the restart policy which applies to containers created
|
- **RestartPolicy** – Specification for the restart policy which applies to containers created
|
||||||
as part of this service.
|
as part of this service.
|
||||||
- **Condition** – Condition for restart (`none`, `on_failure`, or `any`).
|
- **Condition** – Condition for restart (`none`, `on-failure`, or `any`).
|
||||||
- **Delay** – Delay between restart attempts.
|
- **Delay** – Delay between restart attempts.
|
||||||
- **Attempts** – Maximum attempts to restart a given container before giving up (default value
|
- **Attempts** – Maximum attempts to restart a given container before giving up (default value
|
||||||
is 0, which is ignored).
|
is 0, which is ignored).
|
||||||
|
@ -4226,7 +4226,7 @@ Update the service `id`.
|
||||||
- **Memory** – Memory reservation
|
- **Memory** – Memory reservation
|
||||||
- **RestartPolicy** – Specification for the restart policy which applies to containers created
|
- **RestartPolicy** – Specification for the restart policy which applies to containers created
|
||||||
as part of this service.
|
as part of this service.
|
||||||
- **Condition** – Condition for restart (`none`, `on_failure`, or `any`).
|
- **Condition** – Condition for restart (`none`, `on-failure`, or `any`).
|
||||||
- **Delay** – Delay between restart attempts.
|
- **Delay** – Delay between restart attempts.
|
||||||
- **Attempts** – Maximum attempts to restart a given container before giving up (default value
|
- **Attempts** – Maximum attempts to restart a given container before giving up (default value
|
||||||
is 0, which is ignored).
|
is 0, which is ignored).
|
||||||
|
|
|
@ -32,7 +32,7 @@ Options:
|
||||||
--replicas value Number of tasks (default none)
|
--replicas value Number of tasks (default none)
|
||||||
--reserve-cpu value Reserve CPUs (default 0.000)
|
--reserve-cpu value Reserve CPUs (default 0.000)
|
||||||
--reserve-memory value Reserve Memory (default 0 B)
|
--reserve-memory value Reserve Memory (default 0 B)
|
||||||
--restart-condition string Restart when condition is met (none, on_failure, or any)
|
--restart-condition string Restart when condition is met (none, on-failure, or any)
|
||||||
--restart-delay value Delay between restart attempts (default none)
|
--restart-delay value Delay between restart attempts (default none)
|
||||||
--restart-max-attempts value Maximum number of restarts before giving up (default none)
|
--restart-max-attempts value Maximum number of restarts before giving up (default none)
|
||||||
--restart-window value Window used to evaluate the restart policy (default none)
|
--restart-window value Window used to evaluate the restart policy (default none)
|
||||||
|
|
|
@ -35,7 +35,7 @@ Options:
|
||||||
--replicas value Number of tasks (default none)
|
--replicas value Number of tasks (default none)
|
||||||
--reserve-cpu value Reserve CPUs (default 0.000)
|
--reserve-cpu value Reserve CPUs (default 0.000)
|
||||||
--reserve-memory value Reserve Memory (default 0 B)
|
--reserve-memory value Reserve Memory (default 0 B)
|
||||||
--restart-condition string Restart when condition is met (none, on_failure, or any)
|
--restart-condition string Restart when condition is met (none, on-failure, or any)
|
||||||
--restart-delay value Delay between restart attempts (default none)
|
--restart-delay value Delay between restart attempts (default none)
|
||||||
--restart-max-attempts value Maximum number of restarts before giving up (default none)
|
--restart-max-attempts value Maximum number of restarts before giving up (default none)
|
||||||
--restart-window value Window used to evaluate the restart policy (default none)
|
--restart-window value Window used to evaluate the restart policy (default none)
|
||||||
|
|
|
@ -93,7 +93,7 @@ const (
|
||||||
// RestartPolicyConditionNone NONE
|
// RestartPolicyConditionNone NONE
|
||||||
RestartPolicyConditionNone RestartPolicyCondition = "none"
|
RestartPolicyConditionNone RestartPolicyCondition = "none"
|
||||||
// RestartPolicyConditionOnFailure ON_FAILURE
|
// RestartPolicyConditionOnFailure ON_FAILURE
|
||||||
RestartPolicyConditionOnFailure RestartPolicyCondition = "on_failure"
|
RestartPolicyConditionOnFailure RestartPolicyCondition = "on-failure"
|
||||||
// RestartPolicyConditionAny ANY
|
// RestartPolicyConditionAny ANY
|
||||||
RestartPolicyConditionAny RestartPolicyCondition = "any"
|
RestartPolicyConditionAny RestartPolicyCondition = "any"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue