Validate/sanitize swarmkit spec name.
Signed-off-by: Anshul Pundir <anshul.pundir@docker.com>
This commit is contained in:
parent
c5c779adc8
commit
739c4cc6b2
|
@ -228,6 +228,13 @@ func (c *Cluster) Update(version uint64, spec types.Spec, flags types.UpdateFlag
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validate spec name.
|
||||||
|
if spec.Annotations.Name == "" {
|
||||||
|
spec.Annotations.Name = "default"
|
||||||
|
} else if spec.Annotations.Name != "default" {
|
||||||
|
return validationError{errors.New(`swarm spec must be named "default"`)}
|
||||||
|
}
|
||||||
|
|
||||||
// In update, client should provide the complete spec of the swarm, including
|
// In update, client should provide the complete spec of the swarm, including
|
||||||
// Name and Labels. If a field is specified with 0 or nil, then the default value
|
// Name and Labels. If a field is specified with 0 or nil, then the default value
|
||||||
// will be used to swarmkit.
|
// will be used to swarmkit.
|
||||||
|
|
Loading…
Reference in New Issue