summaryrefslogtreecommitdiff
path: root/libpod/info.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-10-11 20:55:37 +0200
committerGitHub <noreply@github.com>2019-10-11 20:55:37 +0200
commit79d05b99cfee2f7841c0568fbe4def4fbc095c5c (patch)
treedce255b558c740c7f22b931e6258089c7a525a68 /libpod/info.go
parentcee6478f9e5e5cdbfe3df8f4894e416e4c5926e4 (diff)
parentb6a7d88397c95a9f3a462274a890b65faafd4d7a (diff)
downloadpodman-79d05b99cfee2f7841c0568fbe4def4fbc095c5c.tar.gz
podman-79d05b99cfee2f7841c0568fbe4def4fbc095c5c.tar.bz2
podman-79d05b99cfee2f7841c0568fbe4def4fbc095c5c.zip
Merge pull request #4220 from mheon/null_runtime
Move OCI runtime implementation behind an interface
Diffstat (limited to 'libpod/info.go')
-rw-r--r--libpod/info.go45
1 files changed, 9 insertions, 36 deletions
diff --git a/libpod/info.go b/libpod/info.go
index 6caa87038..e5c075d97 100644
--- a/libpod/info.go
+++ b/libpod/info.go
@@ -15,7 +15,6 @@ import (
"github.com/containers/buildah"
"github.com/containers/libpod/pkg/cgroups"
"github.com/containers/libpod/pkg/rootless"
- "github.com/containers/libpod/utils"
"github.com/containers/storage"
"github.com/containers/storage/pkg/system"
"github.com/pkg/errors"
@@ -48,14 +47,7 @@ func (r *Runtime) hostInfo() (map[string]interface{}, error) {
info["MemFree"] = mi.MemFree
info["SwapTotal"] = mi.SwapTotal
info["SwapFree"] = mi.SwapFree
- conmonVersion, _ := r.GetConmonVersion()
- ociruntimeVersion, _ := r.GetOCIRuntimeVersion()
hostDistributionInfo := r.GetHostDistributionInfo()
- info["Conmon"] = map[string]interface{}{
- "path": r.conmonPath,
- "package": r.defaultOCIRuntime.conmonPackage(),
- "version": conmonVersion,
- }
if rootless.IsRootless() {
if path, err := exec.LookPath("slirp4netns"); err == nil {
logrus.Warnf("Failed to retrieve program version for %s: %v", path, err)
@@ -82,11 +74,6 @@ func (r *Runtime) hostInfo() (map[string]interface{}, error) {
idmappings["gidmap"] = gidmappings
info["IDMappings"] = idmappings
}
- info["OCIRuntime"] = map[string]interface{}{
- "path": r.defaultOCIRuntime.path,
- "package": r.defaultOCIRuntime.pathPackage(),
- "version": ociruntimeVersion,
- }
info["Distribution"] = map[string]interface{}{
"distribution": hostDistributionInfo["Distribution"],
"version": hostDistributionInfo["Version"],
@@ -98,6 +85,15 @@ func (r *Runtime) hostInfo() (map[string]interface{}, error) {
}
info["kernel"] = kv
+ runtimeInfo, err := r.defaultOCIRuntime.RuntimeInfo()
+ if err != nil {
+ logrus.Errorf("Error getting info on OCI runtime %s: %v", r.defaultOCIRuntime.Name(), err)
+ } else {
+ for k, v := range runtimeInfo {
+ info[k] = v
+ }
+ }
+
up, err := readUptime()
if err != nil {
return nil, errors.Wrapf(err, "error reading up time")
@@ -228,29 +224,6 @@ 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
-}
-
-// GetOCIRuntimePath returns the path to the OCI Runtime Path the runtime is using
-func (r *Runtime) GetOCIRuntimePath() string {
- return r.defaultOCIRuntime.path
-}
-
-// GetOCIRuntimeVersion returns a string representation of the oci runtimes version
-func (r *Runtime) GetOCIRuntimeVersion() (string, error) {
- output, err := utils.ExecCmd(r.GetOCIRuntimePath(), "--version")
- if err != nil {
- return "", err
- }
- return strings.TrimSuffix(output, "\n"), nil
-}
-
// GetHostDistributionInfo returns a map containing the host's distribution and version
func (r *Runtime) GetHostDistributionInfo() map[string]string {
dist := make(map[string]string)