kubenet: Update empty ip check

The previous check was incorrect because the `IP.String` method returns
`<nil>` and other non-empty-strings on error conditions.
pull/6/head
Euan Kemp 2016-05-27 10:15:16 -07:00
parent c4b8959a75
commit 93487867ac
1 changed files with 1 additions and 1 deletions

View File

@ -317,7 +317,7 @@ func (plugin *kubenetNetworkPlugin) SetUpPod(namespace string, name string, id k
if err != nil {
return err
}
if res.IP4 == nil || res.IP4.IP.IP.String() == "" {
if res.IP4 == nil || len(res.IP4.IP.IP) != net.IPv4len {
return fmt.Errorf("CNI plugin reported no IPv4 address for container %v.", id)
}
plugin.podIPs[id] = res.IP4.IP.IP.String()