oci: ignore non existing containers on delete
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
437948a86b
commit
3c0db0bece
2 changed files with 5 additions and 2 deletions
|
@ -474,7 +474,10 @@ func (r *Runtime) StopContainer(c *Container) error {
|
|||
func (r *Runtime) DeleteContainer(c *Container) error {
|
||||
c.opLock.Lock()
|
||||
defer c.opLock.Unlock()
|
||||
return utils.ExecCmdWithStdStreams(os.Stdin, os.Stdout, os.Stderr, r.Path(c), "delete", c.name)
|
||||
if _, err := utils.ExecCmd(r.Path(c), "delete", c.name); err != nil && !strings.Contains(err.Error(), "does not exist") {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// UpdateStatus refreshes the status of the container.
|
||||
|
|
|
@ -23,7 +23,7 @@ func ExecCmd(name string, args ...string) (string, error) {
|
|||
|
||||
err := cmd.Run()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("`%v %v` failed: %v (%v)", name, strings.Join(args, " "), stderr.String(), err)
|
||||
return "", fmt.Errorf("`%v %v` failed: %v (%v)", name, strings.Join(args, " "), stderr.String(), stdout.String(), err)
|
||||
}
|
||||
|
||||
return stdout.String(), nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue