Skip to content

Commit

Permalink
Merge pull request #387 from tangle329/master
Browse files Browse the repository at this point in the history
Check n.IPAM before use it in LoadIPAMConfig function
  • Loading branch information
tomdee authored Mar 2, 2017
2 parents 75a5cf1 + 1003822 commit 1f6efc2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plugins/ipam/host-local/backend/allocator/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ func LoadIPAMConfig(bytes []byte, args string) (*IPAMConfig, string, error) {
return nil, "", err
}

if n.IPAM == nil {
return nil, "", fmt.Errorf("IPAM config missing 'ipam' key")
}

if args != "" {
n.IPAM.Args = &IPAMArgs{}
err := types.LoadArgs(args, n.IPAM.Args)
Expand All @@ -62,10 +66,6 @@ func LoadIPAMConfig(bytes []byte, args string) (*IPAMConfig, string, error) {
}
}

if n.IPAM == nil {
return nil, "", fmt.Errorf("IPAM config missing 'ipam' key")
}

// Copy net name into IPAM so not to drag Net struct around
n.IPAM.Name = n.Name

Expand Down

0 comments on commit 1f6efc2

Please sign in to comment.