Skip to content

Commit

Permalink
Merge pull request #3552 from riyad/add-podman-version-info
Browse files Browse the repository at this point in the history
Expose Podman version info
  • Loading branch information
iwankgb authored Jul 6, 2024
2 parents db6c09c + 4905144 commit f46992f
Showing 1 changed file with 30 additions and 1 deletion.
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

0 comments on commit f46992f

Please sign in to comment.