summaryrefslogtreecommitdiff
diff options
authorPaweł Stołowski <stolowski@gmail.com>2021-04-21 16:18:30 +0000
committerPaweł Stołowski <stolowski@gmail.com>2021-04-21 16:18:30 +0000
commit77170ea8f925de77ab28a90c252d29e36ab898f5 (patch)
tree488eabbbf1f94812f07b1c2f62ed4e19ba450871
parent1410b159b469b6b6c1ad5e55af5878f564c1af4d (diff)
Style tweaks (thanks mvo).refresh-control/store-candidates
-rw-r--r--overlord/snapstate/autorefresh.go16
-rw-r--r--overlord/snapstate/check_snap.go3
-rw-r--r--overlord/snapstate/refreshhints.go22
3 files changed, 21 insertions, 20 deletions
diff --git a/overlord/snapstate/autorefresh.go b/overlord/snapstate/autorefresh.go
index 4278e61816..15a521cb61 100644
--- a/overlord/snapstate/autorefresh.go
+++ b/overlord/snapstate/autorefresh.go
@@ -64,20 +64,20 @@ type refreshCandidate struct {
SnapSetup
}
-func (rh *refreshCandidate) Type() snap.Type {
- return rh.SnapSetup.Type
+func (rc *refreshCandidate) Type() snap.Type {
+ return rc.SnapSetup.Type
}
-func (rh *refreshCandidate) Base() string {
- return rh.SnapSetup.Base
+func (rc *refreshCandidate) Base() string {
+ return rc.SnapSetup.Base
}
-func (rh *refreshCandidate) MakeSnapSetup(*state.State, *SnapState) (*SnapSetup, error) {
- return &rh.SnapSetup, nil
+func (rc *refreshCandidate) MakeSnapSetup(*state.State, *SnapState) (*SnapSetup, error) {
+ return &rc.SnapSetup, nil
}
-func (rh *refreshCandidate) Size() int64 {
- return rh.DownloadInfo.Size
+func (rc *refreshCandidate) Size() int64 {
+ return rc.DownloadInfo.Size
}
// autoRefresh will ensure that snaps are refreshed automatically
diff --git a/overlord/snapstate/check_snap.go b/overlord/snapstate/check_snap.go
index 014f7daa39..000efd06f9 100644
--- a/overlord/snapstate/check_snap.go
+++ b/overlord/snapstate/check_snap.go
@@ -597,8 +597,7 @@ func earlyEpochCheck(info *snap.Info, snapst *SnapState) error {
}
func earlyChecks(st *state.State, snapst *SnapState, update *snap.Info, flags Flags) (Flags, error) {
- var err error
- flags, err = ensureInstallPreconditions(st, update, flags, snapst)
+ flags, err := ensureInstallPreconditions(st, update, flags, snapst)
if err != nil {
return flags, err
}
diff --git a/overlord/snapstate/refreshhints.go b/overlord/snapstate/refreshhints.go
index 8cdd3186f8..12980933e6 100644
--- a/overlord/snapstate/refreshhints.go
+++ b/overlord/snapstate/refreshhints.go
@@ -82,17 +82,19 @@ func (r *refreshHints) refresh() error {
// error. In the future we may retry with a backoff.
r.state.Set("last-refresh-hints", time.Now())
- if err == nil {
- deviceCtx, err := DeviceCtxFromState(r.state, nil)
- if err != nil {
- return err
- }
- hints, err := refreshHintsFromCandidates(r.state, updates, ignoreValidationByInstanceName, deviceCtx)
- if err == nil {
- r.state.Set("refresh-candidates", hints)
- }
+ if err != nil {
+ return err
}
- return err
+ deviceCtx, err := DeviceCtxFromState(r.state, nil)
+ if err != nil {
+ return err
+ }
+ hints, err := refreshHintsFromCandidates(r.state, updates, ignoreValidationByInstanceName, deviceCtx)
+ if err != nil {
+ return err
+ }
+ r.state.Set("refresh-candidates", hints)
+ return nil
}
// AtSeed configures hints refresh policies at end of seeding.