Skip to content

Commit f46992f

Browse files
authored
Merge pull request #3552 from riyad/add-podman-version-info
Expose Podman version info
2 parents db6c09c + 4905144 commit f46992f

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

container/podman/podman.go

+30-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,26 @@ func Status() (v1.DockerStatus, error) {
108108
return v1.DockerStatus{}, err
109109
}
110110

111-
return docker.StatusFromDockerInfo(*podmanInfo)
111+
status, err := docker.StatusFromDockerInfo(*podmanInfo)
112+
if err != nil {
113+
return v1.DockerStatus{}, err
114+
}
115+
116+
podmanVersion, err := VersionString()
117+
if err != nil {
118+
// status.Version will be "Unknown"
119+
return status, err
120+
}
121+
status.Version = podmanVersion
122+
123+
podmanAPIVersion, err := APIVersionString()
124+
if err != nil {
125+
// status.APIVersion will be "Unknown"
126+
return status, err
127+
}
128+
status.APIVersion = podmanAPIVersion
129+
130+
return status, nil
112131
}
113132

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

149+
func APIVersionString() (string, error) {
150+
var version dockertypes.Version
151+
err := apiGetRequest("http://d/v1.0.0/version", &version)
152+
if err != nil {
153+
return "Unknown", err
154+
}
155+
156+
return version.APIVersion, nil
157+
}
158+
130159
func InspectContainer(id string) (dockertypes.ContainerJSON, error) {
131160
var data dockertypes.ContainerJSON
132161
err := apiGetRequest(fmt.Sprintf("http://d/v1.0.0/containers/%s/json", id), &data)

0 commit comments

Comments
 (0)