summaryrefslogtreecommitdiff
path: root/vendor/github.com/projectatomic/buildah/pkg/parse/parse.go
diff options
context:
space:
mode:
authorumohnani8 <umohnani@redhat.com>2018-05-01 13:25:30 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-05-01 20:23:45 +0000
commite98ad5751d12b6ef052803b30fd397101952294e (patch)
tree9e6c0ab61205f1e26c417f5ebfdb393268f94c6a /vendor/github.com/projectatomic/buildah/pkg/parse/parse.go
parent7a0a8552cb4af7af6fc6fb458fd41776f57f543c (diff)
downloadpodman-e98ad5751d12b6ef052803b30fd397101952294e.tar.gz
podman-e98ad5751d12b6ef052803b30fd397101952294e.tar.bz2
podman-e98ad5751d12b6ef052803b30fd397101952294e.zip
Vendor in latest buildah
Adds in --iidfile flag to podman build. Signed-off-by: umohnani8 <umohnani@redhat.com> Closes: #707 Approved by: mheon
Diffstat (limited to 'vendor/github.com/projectatomic/buildah/pkg/parse/parse.go')
-rw-r--r--vendor/github.com/projectatomic/buildah/pkg/parse/parse.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/vendor/github.com/projectatomic/buildah/pkg/parse/parse.go b/vendor/github.com/projectatomic/buildah/pkg/parse/parse.go
index f2159d930..505601f25 100644
--- a/vendor/github.com/projectatomic/buildah/pkg/parse/parse.go
+++ b/vendor/github.com/projectatomic/buildah/pkg/parse/parse.go
@@ -8,6 +8,7 @@ import (
"fmt"
"net"
"os"
+ "path/filepath"
"reflect"
"regexp"
"strings"
@@ -56,7 +57,7 @@ func ParseCommonBuildOptions(c *cli.Context) (*buildah.CommonBuildOptions, error
if _, err := units.FromHumanSize(c.String("shm-size")); err != nil {
return nil, errors.Wrapf(err, "invalid --shm-size")
}
- if err := parseVolumes(c.StringSlice("volume")); err != nil {
+ if err := ParseVolumes(c.StringSlice("volume")); err != nil {
return nil, err
}
@@ -122,7 +123,8 @@ func parseSecurityOpts(securityOpts []string, commonOpts *buildah.CommonBuildOpt
return nil
}
-func parseVolumes(volumes []string) error {
+// ParseVolumes validates the host and container paths passed in to the --volume flag
+func ParseVolumes(volumes []string) error {
if len(volumes) == 0 {
return nil
}
@@ -147,6 +149,9 @@ func parseVolumes(volumes []string) error {
}
func validateVolumeHostDir(hostDir string) error {
+ if !filepath.IsAbs(hostDir) {
+ return errors.Errorf("invalid host path, must be an absolute path %q", hostDir)
+ }
if _, err := os.Stat(hostDir); err != nil {
return errors.Wrapf(err, "error checking path %q", hostDir)
}
@@ -154,8 +159,8 @@ func validateVolumeHostDir(hostDir string) error {
}
func validateVolumeCtrDir(ctrDir string) error {
- if ctrDir[0] != '/' {
- return errors.Errorf("invalid container directory path %q", ctrDir)
+ if !filepath.IsAbs(ctrDir) {
+ return errors.Errorf("invalid container path, must be an absolute path %q", ctrDir)
}
return nil
}