Skip to content

Commit

Permalink
fix #415: double binding to 'server.cols' by viper (#416)
Browse files Browse the repository at this point in the history
* fix: double binding to 'server.cols' by viper

* doc: changelog
  • Loading branch information
avirtopeanu-ionos authored Jan 17, 2024
1 parent 1f2115b commit 4598a08
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
15 changes: 7 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
# Changelog

## [v6.7.4] (December 2023)
## [v6.7.4] (January 2024)

### Added
- Added `version` resource for Dataplatform API, with `list` and `latest` subcommands

### Changed
- When creating a Dataplatform cluster, now the latest version will be used by default

## [v6.7.4] (TBD)

### Added
- Added support for Container-Registry Vulnerabilities
- New `--vulnerability-scanning` flag added to `registry create` and `registry update` commands
- New `artifacts` and `vulnerabilities` commands under `container-registry`
- `repository` command functionality will eventually be moved to `repository delete`. For the time being, both commands are available.

### Changed
- When creating a Dataplatform cluster, now the latest version will be used by default

### Fixed
- Fixed `--cols` for server: `server.cols` Viper variable being used both by `server` and `vm-autoscaling server` commands.

## [v6.7.3] (December 2023)

### Added
Expand Down
2 changes: 1 addition & 1 deletion commands/vm-autoscaling/server/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func Get() *core.Command {
return err
}

colsDesired := viper.GetStringSlice(core.GetFlagName(c.Resource, constants.ArgCols))
colsDesired := viper.GetStringSlice(core.GetFlagName("autoscaling"+c.Resource, constants.ArgCols))
out, err := jsontabwriter.GenerateOutputPreconverted(ls, table,
tabheaders.GetHeaders(allCols, defaultCols, colsDesired))
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion commands/vm-autoscaling/server/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ ionosctl vm-autoscaling server list %s`,
return err
}

colsDesired := viper.GetStringSlice(core.GetFlagName(c.Resource, constants.ArgCols))
colsDesired := viper.GetStringSlice(core.GetFlagName("autoscaling"+c.Resource, constants.ArgCols))
out, err := jsontabwriter.GenerateOutputPreconverted(ls, table,
tabheaders.GetHeaders(allCols, defaultCols, colsDesired))
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion commands/vm-autoscaling/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ func Root() *core.Command {

globalFlags := cmd.GlobalFlags()
globalFlags.StringSliceP(constants.ArgCols, "", defaultCols, tabheaders.ColsMessage(defaultCols))
_ = viper.BindPFlag(core.GetFlagName(cmd.Name(), constants.ArgCols), globalFlags.Lookup(constants.ArgCols))
// TODO: This is a hacky workaround for #415. Remove "autoscaling" when --cols behaviour is refactored.
_ = viper.BindPFlag(core.GetFlagName("autoscaling"+cmd.Command.Name(), constants.ArgCols), globalFlags.Lookup(constants.ArgCols))
_ = cmd.Command.RegisterFlagCompletionFunc(constants.ArgCols, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
return allCols, cobra.ShellCompDirectiveNoFileComp
})
Expand Down

0 comments on commit 4598a08

Please sign in to comment.