From c3d405ce2027a5863271142a1f1b3283a6824429 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Thu, 18 Jun 2026 12:26:36 +0000 Subject: [PATCH] cmd/headscale: run backfillips through apiRunE like the other commands It was the one node command hand-rolling the client lifecycle. --- cmd/headscale/cli/nodes.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/cmd/headscale/cli/nodes.go b/cmd/headscale/cli/nodes.go index 6f0b32af..fa9efdcd 100644 --- a/cmd/headscale/cli/nodes.go +++ b/cmd/headscale/cli/nodes.go @@ -267,17 +267,11 @@ all nodes that are missing. If you remove IPv4 or IPv6 prefixes from the config, it can be run to remove the IPs that should no longer be assigned to nodes.`, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: apiRunE(func(ctx context.Context, client *apiv1.Client, cmd *cobra.Command, args []string) error { if !confirmAction(cmd, "Are you sure that you want to assign/remove IPs to/from nodes?") { return nil } - ctx, client, cancel, err := newHeadscaleAPIClient() - if err != nil { - return fmt.Errorf("connecting to headscale: %w", err) - } - defer cancel() - resp, err := client.BackfillNodeIPs(ctx, apiv1.BackfillNodeIPsParams{ Confirmed: apiv1.NewOptBool(true), }) @@ -286,7 +280,7 @@ be assigned to nodes.`, } return printOutput(cmd, resp.Changes, "Node IPs backfilled successfully") - }, + }), } func nodesToPtables(nodes []apiv1.Node) (pterm.TableData, error) {