Skip to content
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

podman version and --version: fix format, exit #7646

Merged
merged 1 commit into from
Sep 17, 2020

Conversation

edsantiago
Copy link
Collaborator

Three unrelated fixes to version output:

  • podman version --format json: was missing a newline

  • podman version --format TEMPLATE: had too many newlines

  • podman --version: would neither display version nor exit
    if followed by a subcommand ('podman --version ps')

The first two were easy: I used my best tweezers to delicately
pluck and transfer the misplaced \n and place it where needed.

The third was a doozy of a rabbit hole. As best I can tell,
a workaround was added in root.go to override cobra's built-in
Version handling, apparently to avoid having cobra add "-v"
as an alias for "--version". As best I can tell, cobra only
does this if the "-v" shortcut is not already taken (at
least as of Nov 2019: spf13/cobra#996 ).
Also as best I can tell that workaround is purely vestigial,
and removing it is safe. I've manually tested "-v" in podman run,
system df, and rm. I've run system tests.

Signed-off-by: Ed Santiago santiago@redhat.com

Three unrelated fixes to version output:

  * podman version --format json: was missing a newline
  * podman version --format TEMPLATE: had too many newlines

  * podman --version: would neither display version nor exit
    if followed by a subcommand ('podman --version ps')

The first two were easy: I used my best tweezers to delicately
pluck and transfer the misplaced \n and place it where needed.

The third was a doozy of a rabbit hole. As best I can tell,
a workaround was added in root.go to override cobra's built-in
Version handling, apparently to avoid having cobra add "-v"
as an alias for "--version". As best I can tell, cobra only
does this if the "-v" shortcut is not already taken (at
least as of Nov 2019: spf13/cobra#996 ).
Also as best I can tell that workaround is purely vestigial,
and removing it is safe. I've manually tested "-v" in podman run,
system df, and rm. I've run system tests.

Signed-off-by: Ed Santiago <santiago@redhat.com>
@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: edsantiago

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 15, 2020
@edsantiago
Copy link
Collaborator Author

@jwhonce @baude this involves cobra magic, PTAL

@mheon
Copy link
Member

mheon commented Sep 15, 2020

The third thing you call out was to ensure that podman run -v was available as an alias for --volume (and also to ensure that podman run --version, wierd as that might be, continued to work, AFAIK).

@edsantiago
Copy link
Collaborator Author

edsantiago commented Sep 15, 2020

ensure that podman run -v was available as an alias for --volume

It does; I tried to mention that in my commit message (EDIT: because it would be a complete showstopper if it didn't)

also to ensure that podman run --version, wierd as that might be, continued to work

Um, that doesn't work, nor does it work in released podman. I would consider it a bug if it did work...?

@rhatdan
Copy link
Member

rhatdan commented Sep 16, 2020

LGTM

@TomSweeneyRedHat
Copy link
Member

LGTM
tests out well and works as noted by @edsantiago . I'm going to throw on a hold in case @mheon still has questions.

@TomSweeneyRedHat
Copy link
Member

/lgtm
/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 16, 2020
@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 16, 2020
@rhatdan
Copy link
Member

rhatdan commented Sep 17, 2020

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 17, 2020
@openshift-merge-robot openshift-merge-robot merged commit c8d90d0 into containers:master Sep 17, 2020
@edsantiago edsantiago deleted the version_options branch September 17, 2020 20:19
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants