diff options
author | baude <bbaude@redhat.com> | 2018-08-02 16:21:36 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-08-05 23:19:47 +0000 |
commit | 99a37afc3ae0616fa99b39ecdb5a436f2150480f (patch) | |
tree | 0e94863954776633fc80a2d7c9bcf1f0b82d7c53 /libpod/info.go | |
parent | 5acbbf03e3675bc3a61b66493f4b86c07da3f167 (diff) | |
download | podman-99a37afc3ae0616fa99b39ecdb5a436f2150480f.tar.gz podman-99a37afc3ae0616fa99b39ecdb5a436f2150480f.tar.bz2 podman-99a37afc3ae0616fa99b39ecdb5a436f2150480f.zip |
Add Runc and Conmon versions to Podman Version
It will be handy to know the runc and conmon versions as our
code gets into the wild.
Signed-off-by: baude <bbaude@redhat.com>
Closes: #1207
Approved by: rhatdan
Diffstat (limited to 'libpod/info.go')
-rw-r--r-- | libpod/info.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/libpod/info.go b/libpod/info.go index cc9d55553..fe422747c 100644 --- a/libpod/info.go +++ b/libpod/info.go @@ -7,10 +7,12 @@ import ( "os" "runtime" "strconv" + "strings" "time" "github.com/docker/docker/pkg/system" "github.com/pkg/errors" + "github.com/projectatomic/libpod/utils" ) // InfoData holds the info type, i.e store, host etc and the data for each type @@ -84,6 +86,11 @@ func (r *Runtime) hostInfo() (map[string]interface{}, error) { } info["hostname"] = host + // Don't think this should be catastrophic if we cannot get the versions + conmonVersion, _ := r.GetConmonVersion() + ociruntimeVersion, _ := r.GetOCIRuntimeVersion() + info["conmonVersion"] = conmonVersion + info["OCIRuntimeVersion"] = ociruntimeVersion return info, nil } @@ -146,3 +153,21 @@ func readUptime() (string, error) { } return string(f[0]), nil } + +// GetConmonVersion returns a string representation of the conmon version +func (r *Runtime) GetConmonVersion() (string, error) { + output, err := utils.ExecCmd(r.conmonPath, "--version") + if err != nil { + return "", err + } + return strings.TrimSuffix(strings.Replace(output, "\n", ", ", 1), "\n"), nil +} + +// GetOCIRuntimeVersion returns a string representation of the oci runtimes version +func (r *Runtime) GetOCIRuntimeVersion() (string, error) { + output, err := utils.ExecCmd(r.ociRuntimePath, "--version") + if err != nil { + return "", err + } + return strings.TrimSuffix(output, "\n"), nil +} |