metropolis/cli/metroctl: refactor to use RunE instead of log.Fatal
Change-Id: Id5ca65980816e1715a8f08afcdf712292117012a
Reviewed-on: https://review.monogon.dev/c/monogon/+/3441
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
Tested-by: Jenkins CI
diff --git a/metropolis/cli/metroctl/cmd_node_logs.go b/metropolis/cli/metroctl/cmd_node_logs.go
index d21df7b..0b732de 100644
--- a/metropolis/cli/metroctl/cmd_node_logs.go
+++ b/metropolis/cli/metroctl/cmd_node_logs.go
@@ -60,7 +60,10 @@
// First connect to the main management service and figure out the node's IP
// address.
- cc := dialAuthenticated(ctx)
+ cc, err := dialAuthenticated(ctx)
+ if err != nil {
+ return fmt.Errorf("while dialing node: %w", err)
+ }
mgmt := api.NewManagementClient(cc)
nodes, err := core.GetNodes(ctx, mgmt, fmt.Sprintf("node.id == %q", args[0]))
if err != nil {
@@ -85,7 +88,10 @@
fmt.Printf("=== Logs from %s (%s):\n", n.Id, n.Status.ExternalAddress)
// Dial the actual node at its management port.
- cl := dialAuthenticatedNode(ctx, n.Id, n.Status.ExternalAddress, cacert)
+ cl, err := dialAuthenticatedNode(ctx, n.Id, n.Status.ExternalAddress, cacert)
+ if err != nil {
+ return fmt.Errorf("while dialing node: %w", err)
+ }
nmgmt := api.NewNodeManagementClient(cl)
streamMode := api.GetLogsRequest_STREAM_DISABLE