Address review comments

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #229
Approved by: rhatdan
This commit is contained in:
Matthew Heon
2018-01-16 10:13:31 -05:00
committed by Atomic Bot
parent b814a94c34
commit aa20a25ca0
3 changed files with 19 additions and 17 deletions

View File

@ -82,11 +82,11 @@ func (r *Runtime) NewContainer(rSpec *spec.Spec, options ...CtrCreateOption) (c
}
if err := r.state.AddContainerToPod(pod, ctr); err != nil {
return nil, errors.Wrapf(err, "error adding new container to state")
return nil, err
}
} else {
if err := r.state.AddContainer(ctr); err != nil {
return nil, errors.Wrapf(err, "error adding new container to state")
return nil, err
}
}
@ -166,17 +166,17 @@ func (r *Runtime) removeContainer(c *Container, force bool) error {
}
if err := r.state.RemoveContainerFromPod(pod, c); err != nil {
return errors.Wrapf(err, "error removing container %s from state", c.ID())
return err
}
} else {
if err := r.state.RemoveContainer(c); err != nil {
return errors.Wrapf(err, "error removing container from state")
return err
}
}
// Delete the container
// Only do this if we're not ContainerStateConfigured - if we are,
// we haven't been created in runc yet
// we haven't been created in the runtime yet
if c.state.State == ContainerStateConfigured {
if err := r.ociRuntime.deleteContainer(c); err != nil {
return errors.Wrapf(err, "error removing container %s from runc", c.ID())