Fix service mode updating

Unfortunately mode still can’t be modified on current Docker engine API(1.32)
This commit is contained in:
cuigh 2017-10-17 11:07:49 +08:00
parent dfb06445a1
commit b0c0d3a0d9

View File

@ -151,11 +151,13 @@ func ServiceUpdate(info *model.ServiceInfo) error {
// Mode
if info.Mode == "replicated" {
if spec.Mode.Replicated == nil {
spec.Mode.Global = nil
spec.Mode.Replicated = &swarm.ReplicatedService{Replicas: &info.Replicas}
} else {
spec.Mode.Replicated.Replicas = &info.Replicas
}
} else if info.Mode == "global" && spec.Mode.Global == nil {
spec.Mode.Replicated = nil
spec.Mode.Global = &swarm.GlobalService{}
}