diff options
author | openshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com> | 2021-08-09 16:59:23 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-09 16:59:23 +0000 |
commit | 431707c72044154b956944d00b1ba40b303decb2 (patch) | |
tree | 825424e05cdb0a0b8a4e64d8dde78b4df40b2393 | |
parent | 04ab2b16617fe2d3178eb0b461aacbcab609611e (diff) | |
parent | 1adeb2b70f4ec8c293befdb630ebea81ca472fd0 (diff) | |
download | podman-431707c72044154b956944d00b1ba40b303decb2.tar.gz podman-431707c72044154b956944d00b1ba40b303decb2.tar.bz2 podman-431707c72044154b956944d00b1ba40b303decb2.zip |
Merge pull request #11161 from Luap99/slirp-info
podman info show correct slirp4netns path
-rw-r--r-- | libpod/info.go | 29 | ||||
-rw-r--r-- | test/system/005-info.bats | 1 |
2 files changed, 18 insertions, 12 deletions
diff --git a/libpod/info.go b/libpod/info.go index cdc73780f..2b48ea590 100644 --- a/libpod/info.go +++ b/libpod/info.go @@ -141,19 +141,24 @@ func (r *Runtime) hostInfo() (*define.HostInfo, error) { } info.CGroupsVersion = cgroupVersion - if rootless.IsRootless() { - if path, err := exec.LookPath("slirp4netns"); err == nil { - version, err := programVersion(path) - if err != nil { - logrus.Warnf("Failed to retrieve program version for %s: %v", path, err) - } - program := define.SlirpInfo{ - Executable: path, - Package: packageVersion(path), - Version: version, - } - info.Slirp4NetNS = program + slirp4netnsPath := r.config.Engine.NetworkCmdPath + if slirp4netnsPath == "" { + slirp4netnsPath, _ = exec.LookPath("slirp4netns") + } + if slirp4netnsPath != "" { + version, err := programVersion(slirp4netnsPath) + if err != nil { + logrus.Warnf("Failed to retrieve program version for %s: %v", slirp4netnsPath, err) + } + program := define.SlirpInfo{ + Executable: slirp4netnsPath, + Package: packageVersion(slirp4netnsPath), + Version: version, } + info.Slirp4NetNS = program + } + + if rootless.IsRootless() { uidmappings, err := rootless.ReadMappingsProc("/proc/self/uid_map") if err != nil { return nil, errors.Wrapf(err, "error reading uid mappings") diff --git a/test/system/005-info.bats b/test/system/005-info.bats index 50c3ceb30..96ca2c1bd 100644 --- a/test/system/005-info.bats +++ b/test/system/005-info.bats @@ -47,6 +47,7 @@ store.configFile | $expr_path store.graphDriverName | [a-z0-9]\\\+\\\$ store.graphRoot | $expr_path store.imageStore.number | 1 +host.slirp4netns.executable | $expr_path " parse_table "$tests" | while read field expect; do |