From 29ba42bbc4b0918bcde07321e876ea8b251994d7 Mon Sep 17 00:00:00 2001 From: Ulysses Souza Date: Tue, 20 Oct 2020 19:23:54 +0200 Subject: [PATCH] Fix volume create cli bug This passes the pointer to the concrete struct instead of a copy Signed-off-by: Ulysses Souza --- aci/volumes.go | 4 ++-- cli/cmd/volume/command.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/aci/volumes.go b/aci/volumes.go index 151ee5bfe..e04e0728c 100644 --- a/aci/volumes.go +++ b/aci/volumes.go @@ -79,8 +79,8 @@ type VolumeCreateOptions struct { } func (cs *aciVolumeService) Create(ctx context.Context, name string, options interface{}) (volumes.Volume, error) { - opts, ok := options.(VolumeCreateOptions) - if !ok { + opts, ok := options.(*VolumeCreateOptions) + if !ok || opts == nil { return volumes.Volume{}, errors.New("could not read Azure VolumeCreateOptions struct from generic parameter") } w := progress.ContextWriter(ctx) diff --git a/cli/cmd/volume/command.go b/cli/cmd/volume/command.go index 811994028..852a43d46 100644 --- a/cli/cmd/volume/command.go +++ b/cli/cmd/volume/command.go @@ -94,14 +94,14 @@ func createVolume(ctype string) *cobra.Command { aciOpts := aci.VolumeCreateOptions{} cmd.Flags().StringVar(&aciOpts.Account, "storage-account", "", "Storage account name") _ = cmd.MarkFlagRequired("storage-account") - opts = aciOpts + opts = &aciOpts case store.EcsContextType: ecsOpts := ecs.VolumeCreateOptions{} cmd.Flags().StringVar(&ecsOpts.KmsKeyID, "kms-key", "", "ID of the AWS KMS CMK to be used to protect the encrypted file system") cmd.Flags().StringVar(&ecsOpts.PerformanceMode, "performance-mode", "", "performance mode of the file system. (generalPurpose|maxIO)") cmd.Flags().Float64Var(&ecsOpts.ProvisionedThroughputInMibps, "provisioned-throughput", 0, "throughput in MiB/s (1-1024)") cmd.Flags().StringVar(&ecsOpts.ThroughputMode, "throughput-mode", "", "throughput mode (bursting|provisioned)") - opts = ecsOpts + opts = &ecsOpts } return cmd }