mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-13 21:56:38 +01:00
fix(container): rename Stale to MarkedForUpdate
renames the container.Stale field to what it's actually used for, as staleness is not the only factor used to decide whether a container should be updated anymore also hides the private field along with linkedToRestarting
This commit is contained in:
parent
023c1a7d93
commit
cb8e86d705
3 changed files with 16 additions and 16 deletions
|
|
@ -371,7 +371,7 @@ var _ = Describe("the update action", func() {
|
||||||
ExposedPorts: map[nat.Port]struct{}{},
|
ExposedPorts: map[nat.Port]struct{}{},
|
||||||
})
|
})
|
||||||
|
|
||||||
provider.SetStale(true)
|
provider.SetMarkedForUpdate(true)
|
||||||
|
|
||||||
consumer := CreateMockContainerWithConfig(
|
consumer := CreateMockContainerWithConfig(
|
||||||
"test-container-consumer",
|
"test-container-consumer",
|
||||||
|
|
|
||||||
|
|
@ -27,31 +27,31 @@ func NewContainer(containerInfo *types.ContainerJSON, imageInfo *types.ImageInsp
|
||||||
|
|
||||||
// Container represents a running Docker container.
|
// Container represents a running Docker container.
|
||||||
type Container struct {
|
type Container struct {
|
||||||
LinkedToRestarting bool
|
linkedToRestarting bool
|
||||||
Stale bool
|
markedForUpdate bool
|
||||||
|
|
||||||
containerInfo *types.ContainerJSON
|
containerInfo *types.ContainerJSON
|
||||||
imageInfo *types.ImageInspect
|
imageInfo *types.ImageInspect
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsLinkedToRestarting returns the current value of the LinkedToRestarting field for the container
|
// IsLinkedToRestarting returns the current value of the linkedToRestarting field for the container
|
||||||
func (c *Container) IsLinkedToRestarting() bool {
|
func (c *Container) IsLinkedToRestarting() bool {
|
||||||
return c.LinkedToRestarting
|
return c.linkedToRestarting
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsStale returns the current value of the Stale field for the container
|
// IsMarkedForUpdate returns the current value of the markedForUpdate field for the container
|
||||||
func (c *Container) IsStale() bool {
|
func (c *Container) IsMarkedForUpdate() bool {
|
||||||
return c.Stale
|
return c.markedForUpdate
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetLinkedToRestarting sets the LinkedToRestarting field for the container
|
// SetLinkedToRestarting sets the linkedToRestarting field for the container
|
||||||
func (c *Container) SetLinkedToRestarting(value bool) {
|
func (c *Container) SetLinkedToRestarting(value bool) {
|
||||||
c.LinkedToRestarting = value
|
c.linkedToRestarting = value
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetStale implements sets the Stale field for the container
|
// SetMarkedForUpdate sets the markedForUpdate field for the container
|
||||||
func (c *Container) SetStale(value bool) {
|
func (c *Container) SetMarkedForUpdate(value bool) {
|
||||||
c.Stale = value
|
c.markedForUpdate = value
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerInfo fetches JSON info for the container
|
// ContainerInfo fetches JSON info for the container
|
||||||
|
|
@ -208,7 +208,7 @@ func (c Container) Links() []string {
|
||||||
// ToRestart return whether the container should be restarted, either because
|
// ToRestart return whether the container should be restarted, either because
|
||||||
// is stale or linked to another stale container.
|
// is stale or linked to another stale container.
|
||||||
func (c Container) ToRestart() bool {
|
func (c Container) ToRestart() bool {
|
||||||
return c.Stale || c.LinkedToRestarting
|
return c.markedForUpdate || c.linkedToRestarting
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsWatchtower returns a boolean flag indicating whether or not the current
|
// IsWatchtower returns a boolean flag indicating whether or not the current
|
||||||
|
|
|
||||||
|
|
@ -64,8 +64,8 @@ type Container interface {
|
||||||
GetLifecycleCommand(LifecyclePhase) string
|
GetLifecycleCommand(LifecyclePhase) string
|
||||||
GetLifecycleTimeout(LifecyclePhase) time.Duration
|
GetLifecycleTimeout(LifecyclePhase) time.Duration
|
||||||
VerifyConfiguration() error
|
VerifyConfiguration() error
|
||||||
SetStale(bool)
|
SetMarkedForUpdate(bool)
|
||||||
IsStale() bool
|
IsMarkedForUpdate() bool
|
||||||
IsNoPull(UpdateParams) bool
|
IsNoPull(UpdateParams) bool
|
||||||
SetLinkedToRestarting(bool)
|
SetLinkedToRestarting(bool)
|
||||||
IsLinkedToRestarting() bool
|
IsLinkedToRestarting() bool
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue