diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-02-12 02:54:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-12 02:54:34 +0100 |
commit | ea20ead35b69b1259f2ff3b00f558c473a921b95 (patch) | |
tree | 9a7e3faba300608db3dd2ee24fbaf02ebf9e66a3 /cmd/podman/volume_create.go | |
parent | 54a5584d84d37632c1c8480d437a012625526a84 (diff) | |
parent | 358da6c8c0375ad41c4669aeef71f9626710c83e (diff) | |
download | podman-ea20ead35b69b1259f2ff3b00f558c473a921b95.tar.gz podman-ea20ead35b69b1259f2ff3b00f558c473a921b95.tar.bz2 podman-ea20ead35b69b1259f2ff3b00f558c473a921b95.zip |
Merge pull request #2313 from baude/remotevolumecreate
podman-remote volume create
Diffstat (limited to 'cmd/podman/volume_create.go')
-rw-r--r-- | cmd/podman/volume_create.go | 36 |
1 files changed, 6 insertions, 30 deletions
diff --git a/cmd/podman/volume_create.go b/cmd/podman/volume_create.go index e0ff4c341..238579501 100644 --- a/cmd/podman/volume_create.go +++ b/cmd/podman/volume_create.go @@ -4,8 +4,7 @@ import ( "fmt" "github.com/containers/libpod/cmd/podman/cliconfig" - "github.com/containers/libpod/cmd/podman/libpodruntime" - "github.com/containers/libpod/libpod" + "github.com/containers/libpod/libpod/adapter" "github.com/pkg/errors" "github.com/spf13/cobra" ) @@ -41,13 +40,7 @@ func init() { } func volumeCreateCmd(c *cliconfig.VolumeCreateValues) error { - var ( - options []libpod.VolumeCreateOption - err error - volName string - ) - - runtime, err := libpodruntime.GetRuntime(&c.PodmanCommand) + runtime, err := adapter.GetRuntime(&c.PodmanCommand) if err != nil { return errors.Wrapf(err, "error creating libpod runtime") } @@ -57,36 +50,19 @@ func volumeCreateCmd(c *cliconfig.VolumeCreateValues) error { return errors.Errorf("too many arguments, create takes at most 1 argument") } - if len(c.InputArgs) > 0 { - volName = c.InputArgs[0] - options = append(options, libpod.WithVolumeName(volName)) - } - - if c.Flag("driver").Changed { - options = append(options, libpod.WithVolumeDriver(c.String("driver"))) - } - labels, err := getAllLabels([]string{}, c.Label) if err != nil { return errors.Wrapf(err, "unable to process labels") } - if len(labels) != 0 { - options = append(options, libpod.WithVolumeLabels(labels)) - } opts, err := getAllLabels([]string{}, c.Opt) if err != nil { return errors.Wrapf(err, "unable to process options") } - if len(options) != 0 { - options = append(options, libpod.WithVolumeOptions(opts)) - } - vol, err := runtime.NewVolume(getContext(), options...) - if err != nil { - return err + volumeName, err := runtime.CreateVolume(getContext(), c, labels, opts) + if err == nil { + fmt.Println(volumeName) } - fmt.Printf("%s\n", vol.Name()) - - return nil + return err } |