Refactoring & renaming

This commit is contained in:
Brian DeHamer 2015-07-21 16:04:41 +00:00
parent 3dd06cffb1
commit 00f2875abf
15 changed files with 254 additions and 233 deletions

29
actions/check.go Normal file
View file

@ -0,0 +1,29 @@
package actions
import (
"sort"
"github.com/CenturyLinkLabs/watchtower/container"
)
func watchtowerContainersFilter(c container.Container) bool { return c.IsWatchtower() }
func CheckPrereqs() error {
client := container.NewClient()
containers, err := client.ListContainers(watchtowerContainersFilter)
if err != nil {
return err
}
if len(containers) > 1 {
sort.Sort(container.ByCreated(containers))
// Iterate over all containers execept the last one
for _, c := range containers[0 : len(containers)-1] {
client.Stop(c, 60)
}
}
return nil
}