summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorflouthoc <flouthoc.git@gmail.com>2021-08-16 16:36:34 +0530
committerflouthoc <flouthoc.git@gmail.com>2021-08-16 16:36:39 +0530
commitf985699460317be7428d775509ec822fc5be0e25 (patch)
tree429fb21f5f54dd72b94f0677735ad26f78280c38
parenta38d7530dbe7d39cb76c16b2b44f96f870223fca (diff)
downloadpodman-f985699460317be7428d775509ec822fc5be0e25.tar.gz
podman-f985699460317be7428d775509ec822fc5be0e25.tar.bz2
podman-f985699460317be7428d775509ec822fc5be0e25.zip
volume: move validating volume dest from client to server.
[NO TESTS NEEDED] Signed-off-by: flouthoc <flouthoc.git@gmail.com>
-rw-r--r--libpod/options.go4
-rw-r--r--pkg/specgen/volumes.go3
2 files changed, 4 insertions, 3 deletions
diff --git a/libpod/options.go b/libpod/options.go
index b94ef88ba..89901b094 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -1456,6 +1456,10 @@ func WithNamedVolumes(volumes []*ContainerNamedVolume) CtrCreateOption {
return errors.Wrapf(err, "error processing options for named volume %q mounted at %q", vol.Name, vol.Dest)
}
+ if err = parse.ValidateVolumeCtrDir(vol.Dest); err != nil {
+ return errors.Wrapf(err, "error validating destination path for named volume %q mounted at %q", vol.Name, vol.Dest)
+ }
+
ctr.config.NamedVolumes = append(ctr.config.NamedVolumes, &ContainerNamedVolume{
Name: vol.Name,
Dest: vol.Dest,
diff --git a/pkg/specgen/volumes.go b/pkg/specgen/volumes.go
index d85d2bdd1..6bee43745 100644
--- a/pkg/specgen/volumes.go
+++ b/pkg/specgen/volumes.go
@@ -93,9 +93,6 @@ func GenVolumeMounts(volumeFlag []string) (map[string]spec.Mount, map[string]*Na
return nil, nil, nil, errors.New("host directory cannot be empty")
}
}
- if err := parse.ValidateVolumeCtrDir(dest); err != nil {
- return nil, nil, nil, err
- }
cleanDest := filepath.Clean(dest)