-
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
Implement --archive flag for podman cp #10804
Implement --archive flag for podman cp #10804
Conversation
815d15b
to
c9ddf67
Compare
You should also add the other -L, --follow-link Always follow symbol link in SRC_PATH I am not sure what it does, but we need to have it implemented. |
cdafa5d
to
56d259c
Compare
ARCHIVE_TEST_ERROR="1" | ||
fi | ||
|
||
# TODO: uid/gid should be also preserved on way back (GET request) |
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 is however task for another PR.
I would prefer this to be done in another PR. |
56d259c
to
ec4f9d4
Compare
Yes, this should be another PR. |
3d5e292
to
1b58fb6
Compare
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! Looking like a good direction.
4c3f4e0
to
596bfaa
Compare
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 just realized it's a breaking change to the bindings.
We should be able to handle everything on the client side in cmd/podman though. Both, copier.Put and copier.Get allow for chowning. In order to get the data, I think we need to extend podman container inspect
with the necessary information about the user.
The only drawback is that the libpod/archive endpoint would not chown by default anymore, which is a risk I am willing to take.
pkg/bindings/containers/archive.go
Outdated
@@ -49,12 +49,17 @@ func Stat(ctx context.Context, nameOrID string, path string) (*entities.Containe | |||
return statReport, finalErr | |||
} | |||
|
|||
func CopyFromArchive(ctx context.Context, nameOrID string, path string, reader io.Reader) (entities.ContainerCopyFunc, error) { | |||
func CopyFromArchive(ctx context.Context, nameOrID string, path string, reader io.Reader, options *CopyOptions) (entities.ContainerCopyFunc, error) { |
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.
Sorry for noticing just now. This would break the bindings which is something we cannot do at the moment without having to bump Podman to 4.0.
@vrothberg |
Very fair point. Seems like we'd break one way or another :( |
Too bad that Go doesn't have function overloading 😞 |
An alternative solution would be to add a new function to the bindings which supports the new option. Add a clear comment that this will be removed with 4.0 and should not be used by any outside user. It's a trick but sounds like a good compromise at the moment. We can move on with the work and existing (bindings) users won't suddenly break. |
596bfaa
to
33bd2f6
Compare
41ccfb9
to
95f32a6
Compare
@vrothberg @rhatdan PTAL |
95f32a6
to
759ee27
Compare
I thought we would keep the variadic. If they are to be deleted then I rather do original suggestion. |
Yes, for consistency with other bindings.
OK, sounds good to me. Thank you! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: matejvasek, rhatdan 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 |
9e7a39b
to
f71d271
Compare
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.
Other than the naming nit: LGTM
@mheon PTAL
Signed-off-by: Matej Vasek <[email protected]>
f71d271
to
86c6014
Compare
/lgtm |
BTW @matejvasek nice work and thanks. |
to containers/common? where? |
To add a new field to containers.conf which, if set, would overwrite the default value of I think it should go under the "[engine]" table. Naming is always the hardest ... "chown_copied_files"? |
Yes this one will need a good description. |
@matejvasek are there still plans to implement "follow-link" (-L) like docker? |
@ocafebabe I haven't seen need for it so far (for my use), but feel free to submit PR. |
Implement --archive flag for
podman cp
This PR implements for direction when a container is a destination, not a source.
resolves #10801
Signed-off-by: Matej Vasek [email protected]