mirror of
https://gitea.elkins.co/Networking/ccl.git
synced 2025-03-08 19:21:39 -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 {
|
func (c *Container) UpdateCommands() command.Commands {
|
||||||
wasRunning := false
|
wasRunning := false
|
||||||
return command.Commands{
|
return command.Commands{
|
||||||
command.NewFunc("do_update_and_stop", func() error {
|
command.NewFunc("pull_and_stop", func() error {
|
||||||
err := c.pull()
|
err := c.pull()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -295,18 +295,11 @@ func (c *Container) UpdateCommands() command.Commands {
|
|||||||
wasRunning = c.cdata != nil && c.cdata.State != nil && c.cdata.State.Running
|
wasRunning = c.cdata != nil && c.cdata.State != nil && c.cdata.State.Running
|
||||||
if wasRunning {
|
if wasRunning {
|
||||||
var timeout uint = 10
|
var timeout uint = 10
|
||||||
err := containers.Stop(c.conn, c.cdata.ID, &containers.StopOptions{Timeout: &timeout})
|
_ = 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
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}),
|
}),
|
||||||
|
command.NewSet(c.DestroyCommands()),
|
||||||
command.NewSet(c.CreateCommands()),
|
command.NewSet(c.CreateCommands()),
|
||||||
command.NewConditional("restart_if_was_running",
|
command.NewConditional("restart_if_was_running",
|
||||||
func() bool { return wasRunning },
|
func() bool { return wasRunning },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user