mirror of https://github.com/docker/docs.git
Fix #1873
force to validate whether engine's label is like format "key=value" Signed-off-by: Sun Hongliang <allen.sun@daocloud.io>
This commit is contained in:
parent
a839ebdd06
commit
aa6ff494e4
|
@ -423,6 +423,10 @@ func (e *Engine) updateSpecs() error {
|
|||
}
|
||||
for _, label := range info.Labels {
|
||||
kv := strings.SplitN(label, "=", 2)
|
||||
if len(kv) != 2 {
|
||||
message := fmt.Sprintf("Engine (ID: %s, Addr: %s) contains an invalid label (%s) not formatted as \"key=value\".", e.ID, e.Addr, label)
|
||||
return fmt.Errorf(message)
|
||||
}
|
||||
e.Labels[kv[0]] = kv[1]
|
||||
}
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue