From 549b663efb80d974b7fd74456070e17987fc49a1 Mon Sep 17 00:00:00 2001 From: Predrag Janosevic Date: Mon, 20 Jan 2025 13:42:45 +0000 Subject: [PATCH] Fix broken zone flag for sks update command (#662) Adds missing `switchClientZoneV3` call in `sksUpdateCmd`. --- CHANGELOG.md | 1 + cmd/sks_update.go | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65929910..86c22507 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - instance update: fixing no err check after creating client #657 - fix(error): Improve error message on snapshot creation (#655) - security-group show: fix empty response if an API endpoint is misbehaving #660 +- Fix broken zone flag for sks update command #662 ## 1.82.0 diff --git a/cmd/sks_update.go b/cmd/sks_update.go index 563db710..b1954b4c 100644 --- a/cmd/sks_update.go +++ b/cmd/sks_update.go @@ -24,7 +24,7 @@ type sksUpdateCmd struct { Labels map[string]string `cli-flag:"label" cli-usage:"SKS cluster label (format: key=value)"` Name string `cli-usage:"SKS cluster name"` EnableCSIAddon bool `cli-usage:"enable the Exoscale CSI driver"` - Zone string `cli-short:"z" cli-usage:"SKS cluster zone"` + Zone v3.ZoneName `cli-short:"z" cli-usage:"SKS cluster zone"` } func (c *sksUpdateCmd) cmdAliases() []string { return nil } @@ -48,8 +48,12 @@ func (c *sksUpdateCmd) cmdRun(cmd *cobra.Command, _ []string) error { var updated bool ctx := gContext + client, err := switchClientZoneV3(ctx, globalstate.EgoscaleV3Client, c.Zone) + if err != nil { + return err + } - clusters, err := globalstate.EgoscaleV3Client.ListSKSClusters(ctx) + clusters, err := client.ListSKSClusters(ctx) if err != nil { return err } @@ -87,13 +91,13 @@ func (c *sksUpdateCmd) cmdRun(cmd *cobra.Command, _ []string) error { } if updated { - op, err := globalstate.EgoscaleV3Client.UpdateSKSCluster(ctx, cluster.ID, updateReq) + op, err := client.UpdateSKSCluster(ctx, cluster.ID, updateReq) if err != nil { return err } decorateAsyncOperation(fmt.Sprintf("Updating SKS cluster %q...", c.Cluster), func() { - _, err = globalstate.EgoscaleV3Client.Wait(ctx, op, v3.OperationStateSuccess) + _, err = client.Wait(ctx, op, v3.OperationStateSuccess) }) if err != nil { @@ -105,7 +109,7 @@ func (c *sksUpdateCmd) cmdRun(cmd *cobra.Command, _ []string) error { return (&sksShowCmd{ cliCommandSettings: c.cliCommandSettings, Cluster: string(cluster.ID), - Zone: c.Zone, + Zone: string(c.Zone), }).cmdRun(nil, nil) }