Skip to content

Commit 77ab52e

Browse files
committed
fix(iaas): mark image-id flag as hidden
relates to STACKITCLI-404
1 parent f3935cd commit 77ab52e

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

docs/stackit_server_create.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ stackit server create [flags]
4747
--boot-volume-source-id string ID of the source object of boot volume. It can be either an image or volume ID
4848
--boot-volume-source-type string Type of the source object of boot volume. It can be either 'image' or 'volume'
4949
-h, --help Help for "stackit server create"
50-
--image-id string The image ID to be used for an ephemeral disk on the server. Either 'image-id' or 'boot-volume-...' flags are required
5150
--keypair-name string The name of the SSH keypair used during the server creation
5251
--labels stringToString Labels are key-value string pairs which can be attached to a server. E.g. '--labels key1=value1,key2=value2,...' (default [])
5352
--machine-type string Name of the type of the machine for the server. Possible values are documented in https://docs.stackit.cloud/products/compute-engine/server/basics/machine-types/

internal/cmd/server/create/create.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,11 @@ func configureFlags(cmd *cobra.Command) {
182182
cmd.MarkFlagsMutuallyExclusive(imageIdFlag, bootVolumeSourceTypeFlag)
183183
cmd.MarkFlagsMutuallyExclusive(networkIdFlag, networkInterfaceIdsFlag)
184184
cmd.MarkFlagsOneRequired(networkIdFlag, networkInterfaceIdsFlag)
185+
186+
// hide image-id flag from help command to prevent users from using it alone which leads to errors
187+
// instead of using image-id alone, boot-volume flags can be used with type image
188+
cobra.CheckErr(cmd.Flags().MarkHidden(imageIdFlag))
189+
185190
cobra.CheckErr(err)
186191
}
187192

0 commit comments

Comments
 (0)