mirror of
https://gitea.elkins.co/Networking/ccl.git
synced 2025-03-06 18:28:48 -06:00
Fix container.Update
This commit is contained in:
parent
82aa749928
commit
515929fd8f
@ -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 },
|
||||
|
Loading…
x
Reference in New Issue
Block a user