mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-13 13:46: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{}{},
|
||||
})
|
||||
|
||||
provider.SetStale(true)
|
||||
provider.SetMarkedForUpdate(true)
|
||||
|
||||
consumer := CreateMockContainerWithConfig(
|
||||
"test-container-consumer",
|
||||
|
|
|
|||
|
|
@ -27,31 +27,31 @@ func NewContainer(containerInfo *types.ContainerJSON, imageInfo *types.ImageInsp
|
|||
|
||||
// Container represents a running Docker container.
|
||||
type Container struct {
|
||||
LinkedToRestarting bool
|
||||
Stale bool
|
||||
linkedToRestarting bool
|
||||
markedForUpdate bool
|
||||
|
||||
containerInfo *types.ContainerJSON
|
||||
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 {
|
||||
return c.LinkedToRestarting
|
||||
return c.linkedToRestarting
|
||||
}
|
||||
|
||||
// IsStale returns the current value of the Stale field for the container
|
||||
func (c *Container) IsStale() bool {
|
||||
return c.Stale
|
||||
// IsMarkedForUpdate returns the current value of the markedForUpdate field for the container
|
||||
func (c *Container) IsMarkedForUpdate() bool {
|
||||
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) {
|
||||
c.LinkedToRestarting = value
|
||||
c.linkedToRestarting = value
|
||||
}
|
||||
|
||||
// SetStale implements sets the Stale field for the container
|
||||
func (c *Container) SetStale(value bool) {
|
||||
c.Stale = value
|
||||
// SetMarkedForUpdate sets the markedForUpdate field for the container
|
||||
func (c *Container) SetMarkedForUpdate(value bool) {
|
||||
c.markedForUpdate = value
|
||||
}
|
||||
|
||||
// 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
|
||||
// is stale or linked to another stale container.
|
||||
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
|
||||
|
|
|
|||
|
|
@ -64,8 +64,8 @@ type Container interface {
|
|||
GetLifecycleCommand(LifecyclePhase) string
|
||||
GetLifecycleTimeout(LifecyclePhase) time.Duration
|
||||
VerifyConfiguration() error
|
||||
SetStale(bool)
|
||||
IsStale() bool
|
||||
SetMarkedForUpdate(bool)
|
||||
IsMarkedForUpdate() bool
|
||||
IsNoPull(UpdateParams) bool
|
||||
SetLinkedToRestarting(bool)
|
||||
IsLinkedToRestarting() bool
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue