Skip to content

Commit

Permalink
snapstate: refactor UpdateBootRevisions() to make it easier to check …
Browse files Browse the repository at this point in the history
…for boot.SnapTypeParticipatesInBoot()
  • Loading branch information
mvo5 committed Feb 1, 2023
1 parent 41f96ad commit 72f46d1
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions overlord/snapstate/booted.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,13 @@ func UpdateBootRevisions(st *state.State) error {
return err
}

kernel, err := boot.GetCurrentBoot(snap.TypeKernel, deviceCtx)
if err != nil {
return fmt.Errorf(errorPrefix+"%s", err)
}
base, err := boot.GetCurrentBoot(snap.TypeBase, deviceCtx)
if err != nil {
return fmt.Errorf(errorPrefix+"%s", err)
}

var tsAll []*state.TaskSet
for _, actual := range []snap.PlaceInfo{kernel, base} {
for _, typ := range []snap.Type{snap.TypeKernel, snap.TypeBase} {
actual, err := boot.GetCurrentBoot(typ, deviceCtx)
if err != nil {
return fmt.Errorf(errorPrefix+"%s", err)
}

info, err := CurrentInfo(st, actual.SnapName())
if err != nil {
logger.Noticef("cannot get info for %q: %s", actual.SnapName(), err)
Expand Down

0 comments on commit 72f46d1

Please sign in to comment.