From 27178b1c793de11132106ca7da6758ecb216e58b Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Tue, 15 Jan 2019 11:15:36 +0000 Subject: [PATCH] Check and report the error return from getKubePeers() --- prog/kube-utils/main.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/prog/kube-utils/main.go b/prog/kube-utils/main.go index 1ebd098fe1..e0403f7669 100644 --- a/prog/kube-utils/main.go +++ b/prog/kube-utils/main.go @@ -83,6 +83,9 @@ func reclaimRemovedPeers(kube kubernetes.Interface, cml *configMapAnnotations, m return err } nodes, err := getKubePeers(kube, true) + if err != nil { + return err + } nodeSet := make(map[string]struct{}, len(nodes)) for _, node := range nodes { nodeSet[node.name] = struct{}{} @@ -294,9 +297,6 @@ func main() { } return } - if err != nil { - common.Log.Fatalf("[kube-peers] Could not get peers: %v", err) - } if justReclaim { cml := newConfigMapAnnotations(configMapNamespace, configMapName, c) @@ -313,6 +313,9 @@ func main() { return } peers, err := getKubePeers(c, false) + if err != nil { + common.Log.Fatalf("[kube-peers] Could not get peers: %v", err) + } for _, node := range peers { fmt.Println(node.addr) }