summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi/containers.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-08-10 10:23:18 +0000
committerGitHub <noreply@github.com>2022-08-10 10:23:18 +0000
commitaa13c73f7130e7f477a9e1af247b79b39b059923 (patch)
treea1866b6c655a0e1b809ff839bfed3adce7f51d28 /pkg/domain/infra/abi/containers.go
parentc4a35313c93b4384766af914bd1241bb77ebdbe5 (diff)
parent842c6c7c6748f8705698d25a29945f8437f1bed2 (diff)
downloadpodman-aa13c73f7130e7f477a9e1af247b79b39b059923.tar.gz
podman-aa13c73f7130e7f477a9e1af247b79b39b059923.tar.bz2
podman-aa13c73f7130e7f477a9e1af247b79b39b059923.zip
Merge pull request #14926 from cdoern/generateSpec
podman generate spec
Diffstat (limited to 'pkg/domain/infra/abi/containers.go')
-rw-r--r--pkg/domain/infra/abi/containers.go27
1 files changed, 1 insertions, 26 deletions
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go
index 900a51302..5b5bc665e 100644
--- a/pkg/domain/infra/abi/containers.go
+++ b/pkg/domain/infra/abi/containers.go
@@ -7,7 +7,6 @@ import (
"io/ioutil"
"os"
"strconv"
- "strings"
"sync"
"time"
@@ -1675,31 +1674,7 @@ func (ic *ContainerEngine) ContainerClone(ctx context.Context, ctrCloneOpts enti
if err == nil {
n += "-clone"
}
- switch {
- case strings.Contains(n, "-clone"):
- ind := strings.Index(n, "-clone") + 6
- num, err := strconv.Atoi(n[ind:])
- if num == 0 && err != nil { // clone1 is hard to get with this logic, just check for it here.
- _, err = ic.Libpod.LookupContainer(n + "1")
- if err != nil {
- spec.Name = n + "1"
- break
- }
- } else {
- n = n[0:ind]
- }
- err = nil
- count := num
- for err == nil {
- count++
- tempN := n + strconv.Itoa(count)
- _, err = ic.Libpod.LookupContainer(tempN)
- }
- n += strconv.Itoa(count)
- spec.Name = n
- default:
- spec.Name = c.Name() + "-clone"
- }
+ spec.Name = generate.CheckName(ic.Libpod, n, true)
}
rtSpec, spec, opts, err := generate.MakeContainer(context.Background(), ic.Libpod, spec, true, c)