summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-05-27 10:43:36 -0400
committerGitHub <noreply@github.com>2022-05-27 10:43:36 -0400
commitf48bf5808b2d8da423a6d6e53f8e6699ef233d7c (patch)
tree1c39f1664744a01c0d6359e49495c7a11f8ec57d /libpod
parenta72b2402c9569028abbff2364f4f40f4728e5688 (diff)
parent8efdbf5c4c95ece4237aa8ca75f8b0876e65113f (diff)
downloadpodman-f48bf5808b2d8da423a6d6e53f8e6699ef233d7c.tar.gz
podman-f48bf5808b2d8da423a6d6e53f8e6699ef233d7c.tar.bz2
podman-f48bf5808b2d8da423a6d6e53f8e6699ef233d7c.zip
Merge pull request #14393 from jwhonce/wip/archive_todo
Add API support for NoOverwriteDirNonDir
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_api.go6
-rw-r--r--libpod/container_copy_linux.go13
2 files changed, 10 insertions, 9 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go
index 0fab36bdc..d87deb71a 100644
--- a/libpod/container_api.go
+++ b/libpod/container_api.go
@@ -446,7 +446,7 @@ func (c *Container) AddArtifact(name string, data []byte) error {
return define.ErrCtrRemoved
}
- return ioutil.WriteFile(c.getArtifactPath(name), data, 0740)
+ return ioutil.WriteFile(c.getArtifactPath(name), data, 0o740)
}
// GetArtifact reads the specified artifact file from the container
@@ -877,7 +877,7 @@ func (c *Container) ShouldRestart(ctx context.Context) bool {
// CopyFromArchive copies the contents from the specified tarStream to path
// *inside* the container.
-func (c *Container) CopyFromArchive(ctx context.Context, containerPath string, chown bool, rename map[string]string, tarStream io.Reader) (func() error, error) {
+func (c *Container) CopyFromArchive(_ context.Context, containerPath string, chown, noOverwriteDirNonDir bool, rename map[string]string, tarStream io.Reader) (func() error, error) {
if !c.batched {
c.lock.Lock()
defer c.lock.Unlock()
@@ -887,7 +887,7 @@ func (c *Container) CopyFromArchive(ctx context.Context, containerPath string, c
}
}
- return c.copyFromArchive(containerPath, chown, rename, tarStream)
+ return c.copyFromArchive(containerPath, chown, noOverwriteDirNonDir, rename, tarStream)
}
// CopyToArchive copies the contents from the specified path *inside* the
diff --git a/libpod/container_copy_linux.go b/libpod/container_copy_linux.go
index 7566fbb12..9528cd06b 100644
--- a/libpod/container_copy_linux.go
+++ b/libpod/container_copy_linux.go
@@ -23,7 +23,7 @@ import (
"golang.org/x/sys/unix"
)
-func (c *Container) copyFromArchive(path string, chown bool, rename map[string]string, reader io.Reader) (func() error, error) {
+func (c *Container) copyFromArchive(path string, chown, noOverwriteDirNonDir bool, rename map[string]string, reader io.Reader) (func() error, error) {
var (
mountPoint string
resolvedRoot string
@@ -89,11 +89,12 @@ func (c *Container) copyFromArchive(path string, chown bool, rename map[string]s
defer unmount()
defer decompressed.Close()
putOptions := buildahCopiah.PutOptions{
- UIDMap: c.config.IDMappings.UIDMap,
- GIDMap: c.config.IDMappings.GIDMap,
- ChownDirs: idPair,
- ChownFiles: idPair,
- Rename: rename,
+ UIDMap: c.config.IDMappings.UIDMap,
+ GIDMap: c.config.IDMappings.GIDMap,
+ ChownDirs: idPair,
+ ChownFiles: idPair,
+ NoOverwriteDirNonDir: noOverwriteDirNonDir,
+ Rename: rename,
}
return c.joinMountAndExec(