mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #604 from mavenugo/vin-fixes
Fixed a few issues identified during docker integration
This commit is contained in:
commit
dce266d406
3 changed files with 11 additions and 6 deletions
|
@ -152,7 +152,7 @@ func (c *Config) ProcessOptions(options ...Option) {
|
|||
|
||||
// IsValidName validates configuration objects supported by libnetwork
|
||||
func IsValidName(name string) bool {
|
||||
if strings.TrimSpace(name) == "" || strings.Contains(name, ".") {
|
||||
if strings.TrimSpace(name) == "" {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
|
|
@ -52,7 +52,4 @@ func TestValidName(t *testing.T) {
|
|||
if IsValidName(" ") {
|
||||
t.Fatal("Name validation succeeds for a case when it is expected to fail")
|
||||
}
|
||||
if IsValidName("name.with.dots") {
|
||||
t.Fatal("Name validation succeeds for a case when it is expected to fail")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -376,17 +376,25 @@ func (n *network) UnmarshalJSON(b []byte) (err error) {
|
|||
}
|
||||
n.name = netMap["name"].(string)
|
||||
n.id = netMap["id"].(string)
|
||||
n.ipamType = netMap["ipamType"].(string)
|
||||
n.addrSpace = netMap["addrSpace"].(string)
|
||||
n.networkType = netMap["networkType"].(string)
|
||||
n.endpointCnt = uint64(netMap["endpointCnt"].(float64))
|
||||
n.enableIPv6 = netMap["enableIPv6"].(bool)
|
||||
|
||||
if v, ok := netMap["generic"]; ok {
|
||||
n.generic = v.(map[string]interface{})
|
||||
}
|
||||
if v, ok := netMap["persist"]; ok {
|
||||
n.persist = v.(bool)
|
||||
}
|
||||
if v, ok := netMap["ipamType"]; ok {
|
||||
n.ipamType = v.(string)
|
||||
} else {
|
||||
n.ipamType = ipamapi.DefaultIPAM
|
||||
}
|
||||
|
||||
if v, ok := netMap["addrSpace"]; ok {
|
||||
n.addrSpace = v.(string)
|
||||
}
|
||||
if v, ok := netMap["ipamV4Config"]; ok {
|
||||
if err := json.Unmarshal([]byte(v.(string)), &n.ipamV4Config); err != nil {
|
||||
return err
|
||||
|
|
Loading…
Add table
Reference in a new issue