mirror of
https://gitea.elkins.co/Networking/ccl.git
synced 2025-03-08 19:21:39 -06:00
Make wasRunning a bool
This commit is contained in:
parent
3054f40223
commit
ee6abfd1bb
@ -61,7 +61,7 @@ type Container struct {
|
|||||||
|
|
||||||
conn context.Context
|
conn context.Context
|
||||||
cdata *define.InspectContainerData
|
cdata *define.InspectContainerData
|
||||||
wasRunning null.Bool
|
wasRunning bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Container) Init(conn context.Context, nets []network.Network) error {
|
func (c *Container) Init(conn context.Context, nets []network.Network) error {
|
||||||
@ -106,7 +106,7 @@ func (c *Container) Init(conn context.Context, nets []network.Network) error {
|
|||||||
}
|
}
|
||||||
c.conn = conn
|
c.conn = conn
|
||||||
err := c.populateCData()
|
err := c.populateCData()
|
||||||
c.wasRunning.SetValid(c.IsRunning())
|
c.wasRunning = err != nil && c.IsRunning()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ func (c *Container) UpdateCommands() cmd.CommandSet {
|
|||||||
func (c *Container) ConditionalStartCommands() cmd.CommandSet {
|
func (c *Container) ConditionalStartCommands() cmd.CommandSet {
|
||||||
return c.newCommandSet("CONDSTART", cmd.Commands{
|
return c.newCommandSet("CONDSTART", cmd.Commands{
|
||||||
cmd.NewConditional("restart_if_was_running",
|
cmd.NewConditional("restart_if_was_running",
|
||||||
c.wasRunning.ValueOrZero,
|
func() bool { return c.wasRunning },
|
||||||
cmd.NewSet(c.StartCommands()),
|
cmd.NewSet(c.StartCommands()),
|
||||||
cmd.NewNop(),
|
cmd.NewNop(),
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user