mirror of
https://github.com/docker/docs.git
synced 2026-11-01 22:34:29 +03:00
Merge pull request #1874 from allencloud/validate-label's-format
Fix #1873 force to validate engine's label format
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user