From f44f830e9f3ac40b1aa28d4bd64eeebf3aca6237 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Thu, 23 Apr 2020 09:25:15 -0400 Subject: [PATCH] Don't check configuration until user input is applied Signed-off-by: Daniel J Walsh --- cmd/podman/cliconfig/config.go | 1 - cmd/podman/main.go | 3 +++ libpod/runtime.go | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/podman/cliconfig/config.go b/cmd/podman/cliconfig/config.go index 6d98aaf0ec..0ae10e3374 100644 --- a/cmd/podman/cliconfig/config.go +++ b/cmd/podman/cliconfig/config.go @@ -708,7 +708,6 @@ type UntagValues struct { func GetDefaultConfig() *config.Config { var err error conf, err := config.NewConfig("") - conf.CheckCgroupsAndAdjustConfig() if err != nil { logrus.Errorf("Error loading container config %v\n", err) os.Exit(1) diff --git a/cmd/podman/main.go b/cmd/podman/main.go index 4435b036e2..75318db608 100644 --- a/cmd/podman/main.go +++ b/cmd/podman/main.go @@ -126,6 +126,9 @@ func before(cmd *cobra.Command, args []string) error { return err } + defaultContainerConfig.Engine.CgroupManager = MainGlobalOpts.CGroupManager + defaultContainerConfig.CheckCgroupsAndAdjustConfig() + if err := setupRootless(cmd, args); err != nil { return err } diff --git a/libpod/runtime.go b/libpod/runtime.go index a6032ad23c..d5e2c51d80 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -131,8 +131,9 @@ func NewRuntime(ctx context.Context, options ...RuntimeOption) (runtime *Runtime if err != nil { return nil, err } + runtime, err = newRuntimeFromConfig(ctx, conf, options...) conf.CheckCgroupsAndAdjustConfig() - return newRuntimeFromConfig(ctx, conf, options...) + return runtime, err } // NewRuntimeFromConfig creates a new container runtime using the given