Skip to content

Commit

Permalink
Fixes podman-remote save to directories does not work
Browse files Browse the repository at this point in the history
Signed-off-by: zhangguanzhang <[email protected]>
  • Loading branch information
zhangguanzhang committed Apr 15, 2021
1 parent df6c7c2 commit 21827f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions pkg/api/handlers/libpod/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,16 @@ func ExportImages(w http.ResponseWriter, r *http.Request) {
return
}

// if format is dir, server will save to an archive
// the client will unArchive after receive the archive file
// so must convert is at here
switch query.Format {
case define.OCIManifestDir:
query.Format = define.OCIArchive
case define.V2s2ManifestDir:
query.Format = define.V2s2Archive
}

switch query.Format {
case define.V2s2Archive, define.OCIArchive:
tmpfile, err := ioutil.TempFile("", "api.tar")
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/save_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ var _ = Describe("Podman save", func() {
})

It("podman save to directory with oci format", func() {
if rootless.IsRootless() && podmanTest.RemoteTest {
if rootless.IsRootless() {
Skip("Requires a fix in containers image for chown/lchown")
}
outdir := filepath.Join(podmanTest.TempDir, "save")
Expand All @@ -90,7 +90,7 @@ var _ = Describe("Podman save", func() {
})

It("podman save to directory with v2s2 docker format", func() {
if rootless.IsRootless() && podmanTest.RemoteTest {
if rootless.IsRootless() {
Skip("Requires a fix in containers image for chown/lchown")
}
outdir := filepath.Join(podmanTest.TempDir, "save")
Expand Down

0 comments on commit 21827f6

Please sign in to comment.