Skip to content

Commit

Permalink
o/snapstate: make sure to set tracking channel after talking to the s…
Browse files Browse the repository at this point in the history
…tore
  • Loading branch information
andrewphelpsj committed Sep 13, 2024
1 parent 70ab71b commit 8e7d528
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion overlord/snapstate/snapstate_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14003,8 +14003,11 @@ func (s *snapmgrTestSuite) TestUpdateWithComponentsBackToPrevRevision(c *C) {
InstanceName: instanceName,
Revision: prevSnapRev,
SnapID: snapID,
Channel: channel,
ResourceInstall: true,
// note that channel is empty here since we can't provide a
// channel in this case, since we don't know if the revision is
// a part of the channel
Channel: "",
},
revno: prevSnapRev,
userID: 1,
Expand Down
7 changes: 5 additions & 2 deletions overlord/snapstate/storehelpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -748,13 +748,16 @@ func storeUpdatePlanCore(
return updatePlan{}, err
}

revOpts.setChannelIfUnset(snapst.TrackingChannel)

compsups, err := componentSetupsForInstall(ctx, st, compsToInstall, *snapst, si.Revision, revOpts.Channel, opts)
if err != nil {
return updatePlan{}, err
}

// this must happen after the call to componentSetupsForInstall, since
// we can't set the channel to the tracking channel if we don't know
// that the requested revision is part of this channel
revOpts.setChannelIfUnset(snapst.TrackingChannel)

// make sure that we switch the current channel of the snap that we're
// switching to
info.Channel = revOpts.Channel
Expand Down

0 comments on commit 8e7d528

Please sign in to comment.