summaryrefslogtreecommitdiff
path: root/pkg/autoupdate/autoupdate.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-04-15 13:15:10 -0700
committerGitHub <noreply@github.com>2020-04-15 13:15:10 -0700
commit693a8039c840b28f7453255fbd079867dfc36390 (patch)
treedd73dc7ae7dbb8f7f4056788093d644ae2acea93 /pkg/autoupdate/autoupdate.go
parent97bded83027d861bbe5f36543e4d35ee4cd48834 (diff)
parent1a02c9b40c75808791502a050cffb8d9b28b705b (diff)
downloadpodman-693a8039c840b28f7453255fbd079867dfc36390.tar.gz
podman-693a8039c840b28f7453255fbd079867dfc36390.tar.bz2
podman-693a8039c840b28f7453255fbd079867dfc36390.zip
Merge pull request #5776 from vrothberg/au
auto update: skip non-image policies
Diffstat (limited to 'pkg/autoupdate/autoupdate.go')
-rw-r--r--pkg/autoupdate/autoupdate.go25
1 files changed, 16 insertions, 9 deletions
diff --git a/pkg/autoupdate/autoupdate.go b/pkg/autoupdate/autoupdate.go
index 7c243eb00..78d5ac474 100644
--- a/pkg/autoupdate/autoupdate.go
+++ b/pkg/autoupdate/autoupdate.go
@@ -201,18 +201,25 @@ func imageContainersMap(runtime *libpod.Runtime) (map[string][]*libpod.Container
if state != define.ContainerStateRunning {
continue
}
+
// Only update containers with the specific label/policy set.
labels := ctr.Labels()
- if value, exists := labels[Label]; exists {
- policy, err := LookupPolicy(value)
- if err != nil {
- errors = append(errors, err)
- continue
- }
- if policy != PolicyNewImage {
- continue
- }
+ value, exists := labels[Label]
+ if !exists {
+ continue
}
+
+ policy, err := LookupPolicy(value)
+ if err != nil {
+ errors = append(errors, err)
+ continue
+ }
+
+ // Skip non-image labels (could be explicitly disabled).
+ if policy != PolicyNewImage {
+ continue
+ }
+
// Now we know that `ctr` is configured for auto updates.
id, _ := ctr.Image()
imageMap[id] = append(imageMap[id], allContainers[i])