summaryrefslogtreecommitdiff
path: root/libpod/info.go
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2021-08-09 12:43:30 +0200
committerPaul Holzinger <pholzing@redhat.com>2021-08-09 12:59:28 +0200
commit1adeb2b70f4ec8c293befdb630ebea81ca472fd0 (patch)
tree825424e05cdb0a0b8a4e64d8dde78b4df40b2393 /libpod/info.go
parent04ab2b16617fe2d3178eb0b461aacbcab609611e (diff)
downloadpodman-1adeb2b70f4ec8c293befdb630ebea81ca472fd0.tar.gz
podman-1adeb2b70f4ec8c293befdb630ebea81ca472fd0.tar.bz2
podman-1adeb2b70f4ec8c293befdb630ebea81ca472fd0.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>
Diffstat (limited to 'libpod/info.go')
-rw-r--r--libpod/info.go29
1 files changed, 17 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")