mirror of
https://github.com/docker/compose.git
synced 2025-07-23 13:45:00 +02:00
Merge pull request #9944 from glours/map-spec-restart-policy-to-engine
map deploy.restart_policy.condition to engine values
This commit is contained in:
commit
5a1f64532d
@ -488,13 +488,27 @@ func getRestartPolicy(service types.ServiceConfig) container.RestartPolicy {
|
|||||||
attempts = int(*policy.MaxAttempts)
|
attempts = int(*policy.MaxAttempts)
|
||||||
}
|
}
|
||||||
restart = container.RestartPolicy{
|
restart = container.RestartPolicy{
|
||||||
Name: policy.Condition,
|
Name: mapRestartPolicyCondition(policy.Condition),
|
||||||
MaximumRetryCount: attempts,
|
MaximumRetryCount: attempts,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return restart
|
return restart
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func mapRestartPolicyCondition(condition string) string {
|
||||||
|
// map definitions of deploy.restart_policy to engine definitions
|
||||||
|
switch condition {
|
||||||
|
case "none", "no":
|
||||||
|
return "no"
|
||||||
|
case "on-failure", "unless-stopped":
|
||||||
|
return condition
|
||||||
|
case "any", "always":
|
||||||
|
return "always"
|
||||||
|
default:
|
||||||
|
return condition
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func getDeployResources(s types.ServiceConfig) container.Resources {
|
func getDeployResources(s types.ServiceConfig) container.Resources {
|
||||||
var swappiness *int64
|
var swappiness *int64
|
||||||
if s.MemSwappiness != 0 {
|
if s.MemSwappiness != 0 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user