Skip to content

Commit

Permalink
Fix broken zone flag for sks update command (#662)
Browse files Browse the repository at this point in the history
Adds missing `switchClientZoneV3` call in `sksUpdateCmd`.
  • Loading branch information
kobajagi authored Jan 20, 2025
1 parent 52e8505 commit 549b663
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 9 additions & 5 deletions cmd/sks_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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
}
Expand Down Expand Up @@ -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 {
Expand All @@ -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)
}

Expand Down

0 comments on commit 549b663

Please sign in to comment.