Skip to content

Commit

Permalink
Fix broken zone flag for sks update command
Browse files Browse the repository at this point in the history
  • Loading branch information
kobajagi committed Jan 20, 2025
1 parent 52e8505 commit 0fd873b
Showing 1 changed file with 9 additions and 5 deletions.
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 0fd873b

Please sign in to comment.