m/c/metroctl: fix update logic when errors happen
Error handling in the node status polling loop did not exit the current
iteration of the loop when an error was encountered due to missing
control flow statements. This caused the update command to panic when
the node state could not be retrieved.
Change-Id: I802d3073ca0ce85248f6692360879b391ac64e7d
Reviewed-on: https://review.monogon.dev/c/monogon/+/2834
Reviewed-by: Tim Windelschmidt <tim@monogon.tech>
Tested-by: Jenkins CI
diff --git a/metropolis/cli/metroctl/cmd_node.go b/metropolis/cli/metroctl/cmd_node.go
index 18cec83..923da42 100644
--- a/metropolis/cli/metroctl/cmd_node.go
+++ b/metropolis/cli/metroctl/cmd_node.go
@@ -172,12 +172,15 @@
nodes, err := core.GetNodes(ctx, mgmt, fmt.Sprintf("node.id == %q", n.Id))
if err != nil {
log.Printf("while getting node status for %s: %v", n.Id, err)
+ continue
}
if len(nodes) == 0 {
log.Printf("node status for %s returned no node", n.Id)
+ continue
}
if len(nodes) > 1 {
log.Printf("node status for %s returned too many nodes (%d)", n.Id, len(nodes))
+ continue
}
s := nodes[0]
if s.Health == api.Node_HEALTHY {