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

Expose Podman version info #3552

Merged
merged 2 commits into from
Jul 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion container/podman/podman.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,26 @@ func Status() (v1.DockerStatus, error) {
return v1.DockerStatus{}, err
}

return docker.StatusFromDockerInfo(*podmanInfo)
status, err := docker.StatusFromDockerInfo(*podmanInfo)
if err != nil {
return v1.DockerStatus{}, err
}

podmanVersion, err := VersionString()
if err != nil {
// status.Version will be "Unknown"
return status, err
}
status.Version = podmanVersion

podmanAPIVersion, err := APIVersionString()
if err != nil {
// status.APIVersion will be "Unknown"
return status, err
}
status.APIVersion = podmanAPIVersion

return status, nil
}

func GetInfo() (*dockersystem.Info, error) {
Expand All @@ -127,6 +146,16 @@ func VersionString() (string, error) {
return version.Version, nil
}

func APIVersionString() (string, error) {
var version dockertypes.Version
err := apiGetRequest("http://d/v1.0.0/version", &version)
if err != nil {
return "Unknown", err
}

return version.APIVersion, nil
}

func InspectContainer(id string) (dockertypes.ContainerJSON, error) {
var data dockertypes.ContainerJSON
err := apiGetRequest(fmt.Sprintf("http://d/v1.0.0/containers/%s/json", id), &data)
Expand Down
Loading