mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-10-26 15:57:38 +00:00
When adding volumes to DB, handle nontrivial cases
We want to make sure we don't add anything but the host volume, and the volumes can include options and container locations. Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #700 Approved by: rhatdan
This commit is contained in:
parent
dd569a91f4
commit
6ebb90f951
1 changed files with 10 additions and 1 deletions
|
|
@ -653,7 +653,16 @@ func (c *createConfig) GetContainerCreateOptions() ([]libpod.CtrCreateOption, er
|
|||
}
|
||||
|
||||
if len(c.Volumes) != 0 {
|
||||
options = append(options, libpod.WithUserVolumes(c.Volumes))
|
||||
// Volumes consist of multiple, comma-delineated fields
|
||||
// The image spec only includes one part of that, so drop the
|
||||
// others, if they are included
|
||||
volumes := make([]string, 0, len(c.Volumes))
|
||||
for _, vol := range c.Volumes {
|
||||
splitVol := strings.Split(vol, ":")
|
||||
volumes = append(volumes, splitVol[0])
|
||||
}
|
||||
|
||||
options = append(options, libpod.WithUserVolumes(volumes))
|
||||
}
|
||||
|
||||
if len(c.Command) != 0 {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue