-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes podman-remote save to directories does not work #10025
Fixes podman-remote save to directories does not work #10025
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: zhangguanzhang The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
pkg/api/handlers/libpod/images.go
Outdated
@@ -244,6 +244,7 @@ func ExportImages(w http.ResponseWriter, r *http.Request) { | |||
decoder := r.Context().Value("decoder").(*schema.Decoder) | |||
query := struct { | |||
Compress bool `schema:"compress"` | |||
Remote bool `schema:"remote"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed. It is Remote by definition?
pkg/api/handlers/libpod/images.go
Outdated
// client will unArchive after receive the archive file | ||
// so must convert is at here | ||
if query.Remote { | ||
if query.Format == define.OCIManifestDir { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to just do this on the client side and not change the server side at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Server will save to dir, not respone in on file.and client will untar the archive file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am saying that the client checks to see if it is remote and sends across the
query.Format = define.OCIArchive
or
query.Format = define.V2s2Archive
And then dumps it locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am saying that the client checks to see if it is remote and sends across the
query.Format = define.OCIArchive or query.Format = define.V2s2Archive
And then dumps it locally.
if format is an archive, will return at these lines (end at L279)
podman/pkg/domain/infra/tunnel/images.go
Lines 270 to 280 in df6c7c2
exErr := images.Export(ir.ClientCtx, append([]string{nameOrID}, tags...), f, options) | |
if err := f.Close(); err != nil { | |
return err | |
} | |
if exErr != nil { | |
return exErr | |
} | |
if opts.Format != "oci-dir" && opts.Format != "docker-dir" { | |
return nil | |
} |
if is a dir, will recreive an archive of the dir, and untar at this line
podman/pkg/domain/infra/tunnel/images.go
Line 299 in df6c7c2
return utils2.UntarToFileSystem(opts.Output, f, nil) |
The logic already exists, so I don’t need to add it
316f0a1
to
0f9d3a9
Compare
pkg/bindings/images/images.go
Outdated
@@ -143,6 +143,7 @@ func Export(ctx context.Context, nameOrIDs []string, w io.Writer, options *Expor | |||
for _, ref := range nameOrIDs { | |||
params.Add("references", ref) | |||
} | |||
params.Add("remote", "true") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This parameter shouldn't be needed as it's always remote.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I remove all the remote parameter in all files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, yes please remove it.
97229a1
to
0ad20f7
Compare
} | ||
if query.Format == define.V2s2ManifestDir { | ||
query.Format = define.V2s2Archive | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking: a switch query.Format {...}
may be more idiomatic.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
had done
Signed-off-by: zhangguanzhang <[email protected]>
0ad20f7
to
21827f6
Compare
LGTM |
Someone will have to explain to me why this is being done on the server side? Seems like the client knows what it is doing, and the server is not doing what the caller requested. If I write a python client and ask for a directory, I will not have the majic available to convert, and will end up with a mess. Or am I missing something? |
server side always return file bytes in one file: podman/pkg/api/handlers/libpod/images.go Lines 230 to 236 in 6ff56ab
|
Well outvoted and it does fix a bug, so merging. |
Fixes: #9742
Signed-off-by: zhangguanzhang [email protected]