From fa62b6d2380817f9baef36944289d826398a0999 Mon Sep 17 00:00:00 2001 From: Phil Estes Date: Thu, 12 Dec 2019 19:33:04 -0500 Subject: [PATCH] Use logrus instead of printf for warning Signed-off-by: Phil Estes --- cmd/ctr/commands/run/run_unix.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/ctr/commands/run/run_unix.go b/cmd/ctr/commands/run/run_unix.go index fc110685a..ac4e8e9cb 100644 --- a/cmd/ctr/commands/run/run_unix.go +++ b/cmd/ctr/commands/run/run_unix.go @@ -20,7 +20,6 @@ package run import ( gocontext "context" - "fmt" "path/filepath" "strconv" "strings" @@ -34,6 +33,7 @@ import ( "github.com/containerd/containerd/runtime/v2/runc/options" "github.com/opencontainers/runtime-spec/specs-go" "github.com/pkg/errors" + "github.com/sirupsen/logrus" "github.com/urfave/cli" ) @@ -247,14 +247,14 @@ func getNewTaskOpts(context *cli.Context) []containerd.NewTaskOpts { if uidmap := context.String("uidmap"); uidmap != "" { uidMap, err := parseIDMapping(uidmap) if err != nil { - fmt.Printf("warning: expected to parse uidmap: %s\n", err.Error()) + logrus.WithError(err).Warn("unable to parse uidmap; defaulting to uid 0 IO ownership") } tOpts = append(tOpts, containerd.WithUIDOwner(uidMap.HostID)) } if gidmap := context.String("gidmap"); gidmap != "" { gidMap, err := parseIDMapping(gidmap) if err != nil { - fmt.Printf("warning: expected to parse uidmap: %s\n", err.Error()) + logrus.WithError(err).Warn("unable to parse gidmap; defaulting to gid 0 IO ownership") } tOpts = append(tOpts, containerd.WithGIDOwner(gidMap.HostID)) }