From b99dc56817ba2612792db5dee8a030175572ad3c Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Thu, 11 Jan 2018 14:11:05 +0900 Subject: [PATCH] oci: add TODO comments Signed-off-by: Akihiro Suda --- oci/spec_opts_unix.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/oci/spec_opts_unix.go b/oci/spec_opts_unix.go index c054e511b..645db80d1 100644 --- a/oci/spec_opts_unix.go +++ b/oci/spec_opts_unix.go @@ -101,6 +101,8 @@ func WithImageConfig(image Image) SpecOpts { } s.Process.Cwd = cwd if config.User != "" { + // According to OCI Image Spec v1.0.0, the following are valid for Linux: + // user, uid, user:group, uid:gid, uid:group, user:gid parts := strings.Split(config.User, ":") switch len(parts) { case 1: @@ -113,6 +115,7 @@ func WithImageConfig(image Image) SpecOpts { return err } case 2: + // TODO: support username and groupname v, err := strconv.Atoi(parts[0]) if err != nil { return errors.Wrapf(err, "parse uid %s", parts[0]) @@ -256,6 +259,7 @@ func WithUIDGID(uid, gid uint32) SpecOpts { // uid, and not returns error. func WithUserID(uid uint32) SpecOpts { return func(ctx context.Context, client Client, c *containers.Container, s *specs.Spec) (err error) { + // TODO: support non-snapshot rootfs if c.Snapshotter == "" { return errors.Errorf("no snapshotter set for container") } @@ -304,6 +308,7 @@ func WithUserID(uid uint32) SpecOpts { // does not exist, or the username is not found in /etc/passwd, // it returns error. func WithUsername(username string) SpecOpts { + // TODO: support non-snapshot rootfs return func(ctx context.Context, client Client, c *containers.Container, s *specs.Spec) (err error) { if c.Snapshotter == "" { return errors.Errorf("no snapshotter set for container")