diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2018-04-02 12:29:31 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-04-03 14:57:16 +0000 |
commit | f64c1f106c4148a8432e8a8b28e967f2a47fd3a8 (patch) | |
tree | c8f99ed83d0d95a282354b3ec8232082358232d4 /cmd/podman | |
parent | 98b19aeb0ceba4cae10cb89a99ff2af0738027ba (diff) | |
download | podman-f64c1f106c4148a8432e8a8b28e967f2a47fd3a8.tar.gz podman-f64c1f106c4148a8432e8a8b28e967f2a47fd3a8.tar.bz2 podman-f64c1f106c4148a8432e8a8b28e967f2a47fd3a8.zip |
Remove explicit Init() calls in run and start
We no longer require an explicit Init() to start a container, as
Start() will now call Init() if the container is not initialized.
Remove explicit Init() invocations from run and start to help
with dependency ordering - less time for a dependency to go down
before we start.
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Closes: #577
Approved by: rhatdan
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/run.go | 24 | ||||
-rw-r--r-- | cmd/podman/start.go | 4 |
2 files changed, 12 insertions, 16 deletions
diff --git a/cmd/podman/run.go b/cmd/podman/run.go index 10f68e9da..0c174a729 100644 --- a/cmd/podman/run.go +++ b/cmd/podman/run.go @@ -108,16 +108,6 @@ func runCmd(c *cli.Context) error { logrus.Debugf("container %q has CgroupParent %q", ctr.ID(), p) } - if err := ctr.Init(); err != nil { - // This means the command did not exist - exitCode = 127 - if strings.Index(err.Error(), "permission denied") > -1 { - exitCode = 126 - } - return err - } - logrus.Debugf("container storage created for %q", ctr.ID()) - createConfigJSON, err := json.Marshal(createConfig) if err != nil { return err @@ -135,7 +125,12 @@ func runCmd(c *cli.Context) error { // Handle detached start if createConfig.Detach { if err := ctr.Start(); err != nil { - return errors.Wrapf(err, "unable to start container %q", ctr.ID()) + // This means the command did not exist + exitCode = 127 + if strings.Index(err.Error(), "permission denied") > -1 { + exitCode = 126 + } + return err } fmt.Printf("%s\n", ctr.ID()) @@ -147,7 +142,12 @@ func runCmd(c *cli.Context) error { // Handle this when we split streams to allow attaching just stdin/out/err attachChan, err := ctr.StartAndAttach(false, c.String("detach-keys")) if err != nil { - return errors.Wrapf(err, "unable to start container %q", ctr.ID()) + // This means the command did not exist + exitCode = 127 + if strings.Index(err.Error(), "permission denied") > -1 { + exitCode = 126 + } + return err } if c.BoolT("sig-proxy") { diff --git a/cmd/podman/start.go b/cmd/podman/start.go index 366d5c3fc..1a57a538b 100644 --- a/cmd/podman/start.go +++ b/cmd/podman/start.go @@ -91,10 +91,6 @@ func startCmd(c *cli.Context) error { continue } - if err := ctr.Init(); err != nil && errors.Cause(err) != libpod.ErrCtrExists { - return err - } - // We can only be interactive if both the config and the command-line say so if c.Bool("interactive") && !ctr.Config().Stdin { return errors.Errorf("the container was not created with the interactive option") |