Skip to content

Commit

Permalink
overlord: make sure to reference the snap-set-task in kmod tasks
Browse files Browse the repository at this point in the history
The snap-setup-task was not being added to the prepare kernel-modules
task in the case of installing from the store, which made the
installation to fail.
  • Loading branch information
alfonsosanchezbeato committed Oct 11, 2024
1 parent 595ce03 commit 7ba761e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions overlord/snapstate/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func InstallComponents(ctx context.Context, st *state.State, names []string, inf
kmodSetup = st.NewTask("prepare-kernel-modules-components", fmt.Sprintf(
i18n.G("Prepare kernel-modules components for %q%s"), info.InstanceName(), info.Revision,
))
kmodSetup.Set("snap-setup-task", setupSecurity.ID())
}

tss := make([]*state.TaskSet, 0, len(compsups))
Expand Down
8 changes: 7 additions & 1 deletion overlord/snapstate/component_install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -917,10 +917,16 @@ func (s *snapmgrTestSuite) TestInstallComponents(c *C) {
chg.AddAll(ts)
}

snapsup, err := snapstate.TaskSnapSetup(prepareKmodComps)
c.Assert(err, IsNil)
c.Assert(snapsup, NotNil)

for _, ts := range tss[0 : len(tss)-1] {
task := ts.Tasks()[0]
compsup, _, err := snapstate.TaskComponentSetup(task)
compsup, snapsup, err := snapstate.TaskComponentSetup(task)
c.Assert(err, IsNil)
c.Assert(compsup, NotNil)
c.Assert(snapsup, NotNil)

opts := compOptMultiCompInstall
if compNameToType(compsup.ComponentName()) == snap.KernelModulesComponent {
Expand Down

0 comments on commit 7ba761e

Please sign in to comment.