-
Notifications
You must be signed in to change notification settings - Fork 3k
Docker compat: fix JSON key capitalization in podman inspect
#3172
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
Conversation
Output of `podman inspect <container>` has key with name `ID` whereas `docker inspect <container>` uses `Id`. Change tag in struct `ContainerInspectData` for docker compatibility and consistency with output of `podman inspect <image>`.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: rufoa If they are not already assigned, you can assign the PR to them by writing The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @rufoa. Thanks for your PR. I'm waiting for a containers or openshift member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
Can one of the admins verify this patch?
|
|
I don't know how to feel about this one. Our main goal is Docker compatability, but on the other hand we've already shipped a 1.0 and are supposed to be providing some degree of API stability. We could add a flag to toggle between pedantic Docker compat and what we're doing now, but that seems excessive. |
|
I understand your concern. This would indeed potentially break any tooling which is designed around this idiosyncrasy in the inspect schema. And I agree that putting this change behind a flag would be excessive, as would e.g. having duplicate entries for ID and Id. I suppose this possibility should be weighed against how much existing code consumes the output of FWIW the existing substitution trick is pretty brittle, and doesn't cope with variations in whitespace like I wonder whether a simple regex substitution like |
|
@vrothberg @baude @rhatdan Thoughts on this one? |
|
Would putting special casing inside of --format be enough. |
I think that would only be a partial solution as the issue persists when post-processing the data at a later point. Before making a decision on this specific case, I think we should check if there are other fields where identifiers differ. Maybe that would influence our decision making. |
|
I started doing that yesterday, and found a few places where it format was
blatantly wrong (most notably mounts), but I didn't see many other cases of
slightly off
…On Wed, May 22, 2019, 03:02 Valentin Rothberg ***@***.***> wrote:
Would putting special casing inside of --format be enough.
If user looks for matching with Id or ID, we try both cases?
I think that would only be a partial solution as the issue persists when
post-processing the data at a later point. Before making a decision on this
specific case, I think we should check if there are other fields where
identifiers differ. Maybe that would influence our decision making.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3172>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AB3AOCHEKN3LXJP2O4AGXQTPWTVZHANCNFSM4HOGVX4Q>
.
|
|
Just ran into another mismatch (fixing this one won't break the API – I can prepare a separate PR if you want) The but there is no corresponding We just need something like outputFormat = strings.Replace(outputFormat, "{{.Image}}", "{{.ImageID}}", -1)or, imho more robustly, outputFormat = regexp.MustCompile(`\.Image(\W)`).ReplaceAllString(outputFormat, ".ImageID$1") |
|
@rufoa For reference, I'm beginning a major refactor of At this point, I'm thinking that matching the names to the Docker JSON is the correct thing to do - we're going to need to make significant structural changes in several places anyways, so we should try and ensure compatability. |
|
I'd already included the |
|
@mheon Did you make the changes? |
|
☔ The latest upstream changes (presumably #3180) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Yeah, these should have landed with the inspect refactor changes
…On Sat, Jun 8, 2019, 08:46 Atomic Bot ***@***.***> wrote:
☔️ The latest upstream changes (presumably #3180
<#3180>) made this pull request
unmergeable. Please resolve the merge conflicts.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3172>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AB3AOCEARM3WRWM6EBV2FF3PZOS25ANCNFSM4HOGVX4Q>
.
|
|
Thanks @rufoa, I believe we now have your changes in master branch. |
|
Thanks @mheon - the However, the |
|
i.e. this is what I was thinking 39f5ea4...rufoa:rufoa-patch-1 |
The JSON output of
podman inspect <container>has a key with nameID, whereasthe JSON output of
docker inspect <container>has a key with nameId.An attempted fix for this discrepancy was committed in #306. This made
podman inspect --format '{{.Id}}' <container>work correctly by substituting{{.Id}} -> {{.ID}}internally when present in the--formatarg.However this fix is inadequate because it does not also change the name of the key in the full JSON output (e.g. when no
--formatis specified). This causes problems for tooling which does not specify a--formatand instead parses the full JSON output itself.Contrived example:
(The Jenkins "Docker pipeline" plugin works this way and is currently incompatible with podman for this reason.)
This PR changes the JSON tag in the appropriate struct so the correct name is used when marshaled for output.
This also makes the behaviour of
podman inspect <container>consistent withpodman inspect <image>, which already uses the Docker-compatible keyId.