From 515929fd8fd4d2a347b899c5b70b304f041647a5 Mon Sep 17 00:00:00 2001 From: "Joel D. Elkins" Date: Fri, 29 Jul 2022 23:06:31 -0500 Subject: [PATCH] Fix container.Update --- internal/pkg/container/container.go | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/internal/pkg/container/container.go b/internal/pkg/container/container.go index 274e1ae..4aefb68 100644 --- a/internal/pkg/container/container.go +++ b/internal/pkg/container/container.go @@ -287,7 +287,7 @@ func (c *Container) IsCreated() bool { func (c *Container) UpdateCommands() command.Commands { wasRunning := false return command.Commands{ - command.NewFunc("do_update_and_stop", func() error { + command.NewFunc("pull_and_stop", func() error { err := c.pull() if err != nil { return err @@ -295,18 +295,11 @@ func (c *Container) UpdateCommands() command.Commands { wasRunning = c.cdata != nil && c.cdata.State != nil && c.cdata.State.Running if wasRunning { var timeout uint = 10 - err := containers.Stop(c.conn, c.cdata.ID, &containers.StopOptions{Timeout: &timeout}) - if err != nil { - return err - } - _, err = containers.Remove(c.conn, c.cdata.ID, nil) - if err != nil { - return err - } - c.cdata = nil + _ = containers.Stop(c.conn, c.cdata.ID, &containers.StopOptions{Timeout: &timeout}) } return nil }), + command.NewSet(c.DestroyCommands()), command.NewSet(c.CreateCommands()), command.NewConditional("restart_if_was_running", func() bool { return wasRunning },