diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-04-27 12:02:31 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-27 12:02:31 -0400 |
commit | ba9c1f3f17a4f0086d9ac25fe0f211b3c75e514a (patch) | |
tree | 2ebe0ae37886d1e49b1f2cf7ccfc22d5a911db82 /pkg | |
parent | abda7961d63b1d240f72022757e6be1673e43897 (diff) | |
parent | 825c84efe1feaf95e63476db6b9c69510e1b87de (diff) | |
download | podman-ba9c1f3f17a4f0086d9ac25fe0f211b3c75e514a.tar.gz podman-ba9c1f3f17a4f0086d9ac25fe0f211b3c75e514a.tar.bz2 podman-ba9c1f3f17a4f0086d9ac25fe0f211b3c75e514a.zip |
Merge pull request #10149 from rhatdan/volume
Allow docker volume create API to pass without name
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/api/handlers/compat/volumes.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/pkg/api/handlers/compat/volumes.go b/pkg/api/handlers/compat/volumes.go index d86fc1e19..1ff1468e7 100644 --- a/pkg/api/handlers/compat/volumes.go +++ b/pkg/api/handlers/compat/volumes.go @@ -96,11 +96,17 @@ func CreateVolume(w http.ResponseWriter, r *http.Request) { return } - // See if the volume exists already - existingVolume, err := runtime.GetVolume(input.Name) - if err != nil && errors.Cause(err) != define.ErrNoSuchVolume { - utils.InternalServerError(w, err) - return + var ( + existingVolume *libpod.Volume + err error + ) + if len(input.Name) != 0 { + // See if the volume exists already + existingVolume, err = runtime.GetVolume(input.Name) + if err != nil && errors.Cause(err) != define.ErrNoSuchVolume { + utils.InternalServerError(w, err) + return + } } // if using the compat layer and the volume already exists, we |