diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2017-12-18 12:05:06 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-01-03 12:38:18 +0000 |
commit | 00d38cb37958f3c636aa5837b8f01dfad891a0b5 (patch) | |
tree | e0eb9039266a725f5315ac05f3909f7a6a4a309e /cmd/podman/parse.go | |
parent | 8aeb38e4a718925a78606b8aa014bce6b4a4054c (diff) | |
download | podman-00d38cb37958f3c636aa5837b8f01dfad891a0b5.tar.gz podman-00d38cb37958f3c636aa5837b8f01dfad891a0b5.tar.bz2 podman-00d38cb37958f3c636aa5837b8f01dfad891a0b5.zip |
podman create/run need to load information from the image
We should be pulling information out of the image to set the
defaults to use when setting up the container.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Closes: #110
Approved by: mheon
Diffstat (limited to 'cmd/podman/parse.go')
-rw-r--r-- | cmd/podman/parse.go | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/cmd/podman/parse.go b/cmd/podman/parse.go index 53d49c36c..bb45d08c4 100644 --- a/cmd/podman/parse.go +++ b/cmd/podman/parse.go @@ -11,14 +11,12 @@ import ( "io/ioutil" "net" "os" - "os/user" "path" "regexp" "strconv" "strings" units "github.com/docker/go-units" - specs "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime" ) @@ -713,77 +711,6 @@ func parseStorageOpts(storageOpts []string) (map[string]string, error) { //nolin return m, nil } -// parseUser parses the the uid and gid in the format <name|uid>[:<group|gid>] -// for user flag -// FIXME: Issue from https://github.com/projectatomic/buildah/issues/66 -func parseUser(rootdir, userspec string) (specs.User, error) { //nolint - var gid64 uint64 - var gerr error = user.UnknownGroupError("error looking up group") - - spec := strings.SplitN(userspec, ":", 2) - userspec = spec[0] - groupspec := "" - if userspec == "" { - return specs.User{}, nil - } - if len(spec) > 1 { - groupspec = spec[1] - } - - uid64, uerr := strconv.ParseUint(userspec, 10, 32) - if uerr == nil && groupspec == "" { - // We parsed the user name as a number, and there's no group - // component, so we need to look up the user's primary GID. - var name string - name, gid64, gerr = lookupGroupForUIDInContainer(rootdir, uid64) - if gerr == nil { - userspec = name - } else { - if userrec, err := user.LookupId(userspec); err == nil { - gid64, gerr = strconv.ParseUint(userrec.Gid, 10, 32) - userspec = userrec.Name - } - } - } - if uerr != nil { - uid64, gid64, uerr = lookupUserInContainer(rootdir, userspec) - gerr = uerr - } - if uerr != nil { - if userrec, err := user.Lookup(userspec); err == nil { - uid64, uerr = strconv.ParseUint(userrec.Uid, 10, 32) - gid64, gerr = strconv.ParseUint(userrec.Gid, 10, 32) - } - } - - if groupspec != "" { - gid64, gerr = strconv.ParseUint(groupspec, 10, 32) - if gerr != nil { - gid64, gerr = lookupGroupInContainer(rootdir, groupspec) - } - if gerr != nil { - if group, err := user.LookupGroup(groupspec); err == nil { - gid64, gerr = strconv.ParseUint(group.Gid, 10, 32) - } - } - } - - if uerr == nil && gerr == nil { - u := specs.User{ - UID: uint32(uid64), - GID: uint32(gid64), - Username: userspec, - } - return u, nil - } - - err := errors.Wrapf(uerr, "error determining run uid") - if uerr == nil { - err = errors.Wrapf(gerr, "error determining run gid") - } - return specs.User{}, err -} - // convertKVStringsToMap converts ["key=value"] to {"key":"value"} func convertKVStringsToMap(values []string) map[string]string { result := make(map[string]string, len(values)) |