From 6dc1a9b43c2a554390eccd7de3119497e1e649b5 Mon Sep 17 00:00:00 2001 From: Chris Bednarski Date: Tue, 22 Sep 2015 18:33:29 -0700 Subject: [PATCH] Initialize error 'no networks avaialable' before yielding to find an IP address (maybe there are no IP addresses) --- nomad/structs/network.go | 1 + 1 file changed, 1 insertion(+) diff --git a/nomad/structs/network.go b/nomad/structs/network.go index f19a87ded..2a1e61ae8 100644 --- a/nomad/structs/network.go +++ b/nomad/structs/network.go @@ -136,6 +136,7 @@ func (idx *NetworkIndex) yieldIP(cb func(net *NetworkResource, ip net.IP) bool) // AssignNetwork is used to assign network resources given an ask. // If the ask cannot be satisfied, returns nil func (idx *NetworkIndex) AssignNetwork(ask *NetworkResource) (out *NetworkResource, err error) { + err = fmt.Errorf("no networks available") idx.yieldIP(func(n *NetworkResource, ip net.IP) (stop bool) { // Convert the IP to a string ipStr := ip.String()