diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2020-04-28 11:41:53 +0200 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2020-04-30 11:33:33 +0200 |
commit | 65d7f22720b1c5ba4b6bea1d96cd43bb5b04831d (patch) | |
tree | 95914c05c52f389e51551accda0b9837e851ba7b /pkg | |
parent | 27f514544597f68b2f5229a2b2299e2df446afd5 (diff) | |
download | podman-65d7f22720b1c5ba4b6bea1d96cd43bb5b04831d.tar.gz podman-65d7f22720b1c5ba4b6bea1d96cd43bb5b04831d.tar.bz2 podman-65d7f22720b1c5ba4b6bea1d96cd43bb5b04831d.zip |
cmd, podman: handle --pod new:POD
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/specgen/generate/container_create.go | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go index 01ddcf9c8..f04e1548f 100644 --- a/pkg/specgen/generate/container_create.go +++ b/pkg/specgen/generate/container_create.go @@ -24,11 +24,10 @@ func MakeContainer(ctx context.Context, rt *libpod.Runtime, s *specgen.SpecGener // If joining a pod, retrieve the pod for use. var pod *libpod.Pod if s.Pod != "" { - foundPod, err := rt.LookupPod(s.Pod) + pod, err = rt.LookupPod(s.Pod) if err != nil { return nil, errors.Wrapf(err, "error retrieving pod %s", s.Pod) } - pod = foundPod } // Set defaults for unset namespaces @@ -130,12 +129,8 @@ func createContainerOptions(rt *libpod.Runtime, s *specgen.SpecGenerator, pod *l logrus.Debugf("setting container name %s", s.Name) options = append(options, libpod.WithName(s.Name)) } - if s.Pod != "" { - pod, err := rt.LookupPod(s.Pod) - if err != nil { - return nil, err - } - logrus.Debugf("adding container to pod %s", s.Pod) + if pod != nil { + logrus.Debugf("adding container to pod %s", pod.Name) options = append(options, rt.WithPod(pod)) } destinations := []string{} |