aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2021-08-09 12:43:30 +0200
committerMatthew Heon <matthew.heon@pm.me>2021-08-11 15:28:18 -0400
commit66c0024a0b7975fc88dd1f457151ce925acdee8a (patch)
treedfa9ab6d1fcaa2c2617e6a47f08fe9603e21182d
parentd746a7e0938a5e3b8dde64826961ef9259db7447 (diff)
downloadpodman-66c0024a0b7975fc88dd1f457151ce925acdee8a.tar.gz
podman-66c0024a0b7975fc88dd1f457151ce925acdee8a.tar.bz2
podman-66c0024a0b7975fc88dd1f457151ce925acdee8a.zip
podman info show correct slirp4netns path
The slirp4netns path can be set in the config file or with --network-cmd-path. Podman info should read the version information correctly and not use PATH in this case. Also show the slirp4netns version information to root users. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
-rw-r--r--libpod/info.go29
-rw-r--r--test/system/005-info.bats1
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