summaryrefslogtreecommitdiff
path: root/pkg/autoupdate
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-06-25 11:15:34 +0200
committerValentin Rothberg <rothberg@redhat.com>2021-07-13 13:52:46 +0200
commit6fcf0b2f3238a6f1fc0131e14f3a8125a903e218 (patch)
tree0338fadbd449a7c1816b4e25b247209a85b0ee35 /pkg/autoupdate
parenta90a4ec7c6be5bd293d22f562bf5f975e65c2990 (diff)
downloadpodman-6fcf0b2f3238a6f1fc0131e14f3a8125a903e218.tar.gz
podman-6fcf0b2f3238a6f1fc0131e14f3a8125a903e218.tar.bz2
podman-6fcf0b2f3238a6f1fc0131e14f3a8125a903e218.zip
auto update: minor style nits
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'pkg/autoupdate')
-rw-r--r--pkg/autoupdate/autoupdate.go13
1 files changed, 4 insertions, 9 deletions
diff --git a/pkg/autoupdate/autoupdate.go b/pkg/autoupdate/autoupdate.go
index c812f8fd7..6c21d1788 100644
--- a/pkg/autoupdate/autoupdate.go
+++ b/pkg/autoupdate/autoupdate.go
@@ -12,6 +12,7 @@ import (
"github.com/containers/image/v5/transports/alltransports"
"github.com/containers/podman/v3/libpod"
"github.com/containers/podman/v3/libpod/define"
+ "github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/systemd"
systemdDefine "github.com/containers/podman/v3/pkg/systemd/define"
"github.com/pkg/errors"
@@ -118,7 +119,7 @@ func ValidateImageReference(imageName string) error {
//
// It returns a slice of successfully restarted systemd units and a slice of
// errors encountered during auto update.
-func AutoUpdate(ctx context.Context, runtime *libpod.Runtime, options Options) ([]string, []error) {
+func AutoUpdate(ctx context.Context, runtime *libpod.Runtime, options Options) (*entities.AutoUpdateReport, []error) {
// Create a map from `image ID -> []*Container`.
containerMap, errs := imageContainersMap(runtime)
if len(containerMap) == 0 {
@@ -224,7 +225,7 @@ func AutoUpdate(ctx context.Context, runtime *libpod.Runtime, options Options) (
updatedUnits = append(updatedUnits, unit)
}
- return updatedUnits, errs
+ return &entities.AutoUpdateReport{Units: updatedUnits}, errs
}
// imageContainersMap generates a map[image ID] -> [containers using the image]
@@ -297,7 +298,6 @@ func newerRemoteImageAvailable(ctx context.Context, runtime *libpod.Runtime, img
if err != nil {
return false, err
}
-
return img.HasDifferentDigest(ctx, remoteRef)
}
@@ -307,12 +307,7 @@ func newerLocalImageAvailable(runtime *libpod.Runtime, img *libimage.Image, rawI
if err != nil {
return false, err
}
-
- localDigest := localImg.Digest().String()
-
- ctrDigest := img.Digest().String()
-
- return localDigest != ctrDigest, nil
+ return localImg.Digest().String() != img.Digest().String(), nil
}
// updateImage pulls the specified image.