summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-01-14 22:03:01 -0500
committerGitHub <noreply@github.com>2021-01-14 22:03:01 -0500
commit3fcf346890c0437611fc18c30d58cc2d9f61fe6c (patch)
treea948999192d2089474214f4307eb454a9d0c2c59 /pkg/domain/infra/abi
parent8ce9995951b14a0a4d7252cdd97597411fd5f980 (diff)
parent997de2f8e9e5453a99108bde012aa6c41d7323ec (diff)
downloadpodman-3fcf346890c0437611fc18c30d58cc2d9f61fe6c.tar.gz
podman-3fcf346890c0437611fc18c30d58cc2d9f61fe6c.tar.bz2
podman-3fcf346890c0437611fc18c30d58cc2d9f61fe6c.zip
Merge pull request #8955 from mheon/rename
Container Rename
Diffstat (limited to 'pkg/domain/infra/abi')
-rw-r--r--pkg/domain/infra/abi/containers.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go
index b5f5a0e91..a8f4d44a8 100644
--- a/pkg/domain/infra/abi/containers.go
+++ b/pkg/domain/infra/abi/containers.go
@@ -902,7 +902,7 @@ func (ic *ContainerEngine) ContainerRun(ctx context.Context, opts entities.Conta
if err := ic.Libpod.RemoveContainer(ctx, ctr, false, true); err != nil {
if errors.Cause(err) == define.ErrNoSuchCtr ||
errors.Cause(err) == define.ErrCtrRemoved {
- logrus.Warnf("Container %s does not exist: %v", ctr.ID(), err)
+ logrus.Infof("Container %s was already removed, skipping --rm", ctr.ID())
} else {
logrus.Errorf("Error removing container %s: %v", ctr.ID(), err)
}
@@ -1312,3 +1312,17 @@ func (ic *ContainerEngine) ShouldRestart(ctx context.Context, nameOrID string) (
return &entities.BoolReport{Value: ctr.ShouldRestart(ctx)}, nil
}
+
+// ContainerRename renames the given container.
+func (ic *ContainerEngine) ContainerRename(ctx context.Context, nameOrID string, opts entities.ContainerRenameOptions) error {
+ ctr, err := ic.Libpod.LookupContainer(nameOrID)
+ if err != nil {
+ return err
+ }
+
+ if _, err := ic.Libpod.RenameContainer(ctx, ctr, opts.NewName); err != nil {
+ return err
+ }
+
+ return nil
+}