libpod: fix check for systemd session

move the check after the cgroup manager is set, so to correctly detect
--cgroup-manager=cgroupfs and do not raise a warning about dbus not
being present.

Closes: https://github.com/containers/podman/issues/12802

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano
2022-01-12 21:15:30 +01:00
parent 3f0661639c
commit 194d14ca2f
2 changed files with 7 additions and 1 deletions

View File

@ -170,7 +170,6 @@ func NewRuntime(ctx context.Context, options ...RuntimeOption) (*Runtime, error)
if err != nil {
return nil, err
}
conf.CheckCgroupsAndAdjustConfig()
return newRuntimeFromConfig(ctx, conf, options...)
}
@ -228,6 +227,8 @@ func newRuntimeFromConfig(ctx context.Context, conf *config.Config, options ...R
return nil, err
}
runtime.config.CheckCgroupsAndAdjustConfig()
return runtime, nil
}

View File

@ -276,4 +276,9 @@ LISTEN_FDNAMES=listen_fdnames" | sort)
is "$output" ".*--template cannot be set" "Error message should be '--template requires --new'"
}
@test "podman --cgroup=cgroupfs doesn't show systemd warning" {
DBUS_SESSION_BUS_ADDRESS= run_podman --log-level warning --cgroup-manager=cgroupfs info -f ''
is "$output" "" "output should be empty"
}
# vim: filetype=sh