From 807624aab3131a49f1200102bff1259316c05e56 Mon Sep 17 00:00:00 2001 From: Andrea Barberio Date: Mon, 29 Apr 2019 23:59:45 +0100 Subject: [netboot] Return error when there is one The current implementation has a bug, so that it always returns `nil`, even when an error happened. This PR fixes it. Signed-off-by: Andrea Barberio --- netboot/netboot.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'netboot') diff --git a/netboot/netboot.go b/netboot/netboot.go index 0b854c6..bfa7ce5 100644 --- a/netboot/netboot.go +++ b/netboot/netboot.go @@ -33,11 +33,11 @@ func RequestNetbootv6(ifname string, timeout time.Duration, retries int, modifie conversation, err = client.Exchange(ifname, modifiers...) if err != nil { log.Printf("Client.Exchange failed: %v", err) - log.Printf("sleeping %v before retrying", delay) if i >= retries { // don't wait at the end of the last attempt - break + return nil, fmt.Errorf("netboot failed after %d attempts: %v", retries+1, err) } + log.Printf("sleeping %v before retrying", delay) sleeper(delay) // TODO add random splay delay = delay * 2 -- cgit v1.2.3