From 13fe146840c4d9d27fd509189735ce0fc7b944f8 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 9 Oct 2019 23:12:10 +0200 Subject: rootless: detect no system session with --cgroup-manager=systemd if the cgroup manager is set to systemd, detect if dbus is available, otherwise fallback to --cgroup-manager=cgroupfs. Signed-off-by: Giuseppe Scrivano --- cmd/podman/main_local.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'cmd/podman/main_local.go') diff --git a/cmd/podman/main_local.go b/cmd/podman/main_local.go index bdffb6b1e..202d93b35 100644 --- a/cmd/podman/main_local.go +++ b/cmd/podman/main_local.go @@ -174,14 +174,13 @@ func setupRootless(cmd *cobra.Command, args []string) error { if err != nil { return err } - + conf, err := runtime.GetConfig() + if err != nil { + return err + } if !ownsCgroup { unitName := fmt.Sprintf("podman-%d.scope", os.Getpid()) if err := utils.RunUnderSystemdScope(os.Getpid(), "user.slice", unitName); err != nil { - conf, err2 := runtime.GetConfig() - if err2 != nil { - return err2 - } if conf.CgroupManager == libpod.SystemdCgroupsManager { logrus.Warnf("Failed to add podman to systemd sandbox cgroup: %v", err) } else { -- cgit v1.2.3-54-g00ecf