()
| 280 | } |
| 281 | |
| 282 | func defaultRestartPolicy() *swarm.RestartPolicy { |
| 283 | defaultMaxAttempts := defaults.Service.Task.Restart.MaxAttempts |
| 284 | rp := &swarm.RestartPolicy{ |
| 285 | MaxAttempts: &defaultMaxAttempts, |
| 286 | } |
| 287 | |
| 288 | if defaults.Service.Task.Restart.Delay != nil { |
| 289 | defaultRestartDelay, _ := gogotypes.DurationFromProto(defaults.Service.Task.Restart.Delay) |
| 290 | rp.Delay = &defaultRestartDelay |
| 291 | } |
| 292 | if defaults.Service.Task.Restart.Window != nil { |
| 293 | defaultRestartWindow, _ := gogotypes.DurationFromProto(defaults.Service.Task.Restart.Window) |
| 294 | rp.Window = &defaultRestartWindow |
| 295 | } |
| 296 | rp.Condition = defaultRestartCondition() |
| 297 | |
| 298 | return rp |
| 299 | } |
| 300 | |
| 301 | func defaultRestartCondition() swarm.RestartPolicyCondition { |
| 302 | switch defaults.Service.Task.Restart.Condition { |
no test coverage detected
searching dependent graphs…