Skip to content

Commit

Permalink
Log warn instead of error for removing nonexistant container
Browse files Browse the repository at this point in the history
In event of a container removal that is no longer in database, log a
warning instead of an error, as there is not any problem continuing
execution.

Resolves containers#4314

Signed-off-by: Tyler Ramer <tyaramer@gmail.com>
  • Loading branch information
tylarb committed Oct 25, 2019
1 parent a01cb22 commit 1d00ace
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/adapter/containers.go
Expand Up @@ -438,7 +438,11 @@ func (r *LocalRuntime) Run(ctx context.Context, c *cliconfig.RunValues, exitCode

if c.IsSet("rm") {
if err := r.Runtime.RemoveContainer(ctx, ctr, false, true); err != nil {
logrus.Errorf("Error removing container %s: %v", ctr.ID(), err)
if errors.Cause(err) == define.ErrNoSuchCtr {
logrus.Warnf("Container %s does not exist: %v", ctr.ID(), err)
} else {
logrus.Errorf("Error removing container %s: %v", ctr.ID(), err)
}
}
}

Expand Down

0 comments on commit 1d00ace

Please sign in to comment.