Browse Source

Fix volume create cli bug

This passes the pointer to the concrete struct instead of a copy

Signed-off-by: Ulysses Souza <[email protected]>
Ulysses Souza 5 years ago
parent
commit
29ba42bbc4
2 changed files with 4 additions and 4 deletions
  1. 2 2
      aci/volumes.go
  2. 2 2
      cli/cmd/volume/command.go

+ 2 - 2
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)

+ 2 - 2
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
 }