Use getResourcePath instead

Also cleans up tests to not shell out for file creation.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
Brian Goff
2015-03-31 15:10:30 -04:00
parent 7583b49125
commit 63708dca8a
2 changed files with 27 additions and 30 deletions
+3 -3
View File
@@ -189,13 +189,13 @@ func (container *Container) parseVolumeMountConfig() (map[string]*Mount, error)
if _, exists := container.Volumes[path]; exists {
continue
}
realpath, err := symlink.FollowSymlinkInScope(filepath.Join(container.basefs, path), container.basefs)
realPath, err := container.getResourcePath(path)
if err != nil {
return nil, fmt.Errorf("failed to evaluate the absolute path of symlink")
}
if stat, err := os.Stat(realpath); err == nil {
if stat, err := os.Stat(realPath); err == nil {
if !stat.IsDir() {
return nil, fmt.Errorf("file exists at %s, can't create volume there", realpath)
return nil, fmt.Errorf("file exists at %s, can't create volume there", realPath)
}
}