mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Small cleanup in integration-cli/docker_utils.go
👼
- Move *one-shot* (one use) function where it is actually used (easier to know what's going on). - Remove `pullImageIfNotExist` function as it might be an artifact from way back. We don't need it as we already have frozen/loaded image of busybox. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
parent
1dece339c3
commit
b2320d121c
4 changed files with 29 additions and 162 deletions
|
@ -6,6 +6,8 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/pkg/integration/checker"
|
||||
"github.com/docker/docker/pkg/system"
|
||||
|
@ -37,3 +39,20 @@ func (s *DockerSuite) TestCpCheckDestOwnership(c *check.C) {
|
|||
c.Assert(stat.UID(), checker.Equals, uint32(uid), check.Commentf("Copied file not owned by container root UID"))
|
||||
c.Assert(stat.GID(), checker.Equals, uint32(gid), check.Commentf("Copied file not owned by container root GID"))
|
||||
}
|
||||
|
||||
func getRootUIDGID() (int, int, error) {
|
||||
uidgid := strings.Split(filepath.Base(dockerBasePath), ".")
|
||||
if len(uidgid) == 1 {
|
||||
//user namespace remapping is not turned on; return 0
|
||||
return 0, 0, nil
|
||||
}
|
||||
uid, err := strconv.Atoi(uidgid[0])
|
||||
if err != nil {
|
||||
return 0, 0, err
|
||||
}
|
||||
gid, err := strconv.Atoi(uidgid[1])
|
||||
if err != nil {
|
||||
return 0, 0, err
|
||||
}
|
||||
return uid, gid, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue