Skip to content

feat: print client info from podman version when the server is not available#28265

Open
kyounghunJang wants to merge 1 commit intocontainers:mainfrom
kyounghunJang:main
Open

feat: print client info from podman version when the server is not available#28265
kyounghunJang wants to merge 1 commit intocontainers:mainfrom
kyounghunJang:main

Conversation

@kyounghunJang
Copy link
Contributor

What this PR does

In remote mode, podman version currently returns a connection error before printing any version information if it cannot connect to the service.

Introduce a reusable PrintVersion helper and invoke it at the root level when a ConnectionError is encountered. This ensures that client information is still shown even when the server cannot be reached.

Before

# podman version
Cannot connect to Podman. Please verify your connection to the Linux system using `podman system connection list`, or try `podman machine init` and `podman machine start` to manage a new Linux VM
Error: unable to connect to Podman socket: failed to connect: dial tcp 127.0.0.1:62099: connect: connection refused

After

# ./bin/darwin/podman version  
Client:       Podman Engine
Version:      6.0.0-dev
API Version:  6.0.0-dev
Go Version:   go1.24.6
Git Commit:   f7aefa46bbe5f0d8b1cfb0ff7b9fcd5fee2a9545-dirty
Built:        Wed Mar 11 16:36:32 2026
OS/Arch:      darwin/arm64
Cannot connect to Podman. Please verify your connection to the Linux system using `podman system connection list`, or try `podman machine init` and `podman machine start` to manage a new Linux VM
Error: unable to connect to Podman socket: failed to connect: dial tcp 127.0.0.1:64672: connect: connection refused

Fixes: #28222

Checklist

Ensure you have completed the following checklist for your pull request to be reviewed:

  • Certify you wrote the patch or otherwise have the right to pass it on as an open-source patch by signing all
    commits. (git commit -s). (If needed, use git commit -s --amend). The author email must match
    the sign-off email address. See CONTRIBUTING.md
    for more information.
  • Referenced issues using Fixes: #00000 in commit message (if applicable)
  • Tests have been added/updated (or no tests are needed)
  • Documentation has been updated (or no documentation changes are needed)
  • All commits pass make validatepr (format/lint checks)
  • Release note entered in the section below (or None if no user-facing changes)

Does this PR introduce a user-facing change?


@packit-as-a-service
Copy link

[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore.

Copy link
Member

@Honny1 Honny1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I have a few comments regarding the tests, but otherwise, LGTM.

…ailable

In remote mode, `podman version` currently returns a connection error before
printing any version information if it cannot connect to the service.

Introduce a reusable `PrintVersion` helper and invoke it at the root level
when a `ConnectionError` is encountered. This ensures that client information
is still shown even when the server cannot be reached.

Fixes: containers#28222
Signed-off-by: KyounghoonJang <matkimchi_@naver.com>
Copy link
Member

@Honny1 Honny1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Honny1
Copy link
Member

Honny1 commented Mar 13, 2026

@danishprakash Does your approval count as an LGTM?

Copy link
Member

@danishprakash danishprakash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, LGTM

@TomSweeneyRedHat TomSweeneyRedHat changed the title feat: print client info from podman version when the server is ailable feat: print client info from podman version when the server is not available Mar 13, 2026
@TomSweeneyRedHat
Copy link
Member

I think the title "feat: print client info from podman version when the server is ailable" should be "feat: print client info from podman version when the server is not available" and have changed it. Holler if that is incorrect.

@TomSweeneyRedHat
Copy link
Member

LGTM
I restarted what looks to be flakey tests not related to this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use podman-version without starting the podman machine

4 participants