From 7ba761e4e71e364fad4cf97be7df24c6bd2a929d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alfonso=20S=C3=A1nchez-Beato?= Date: Fri, 11 Oct 2024 10:24:57 -0400 Subject: [PATCH] overlord: make sure to reference the snap-set-task in kmod tasks 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. --- overlord/snapstate/component.go | 1 + overlord/snapstate/component_install_test.go | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/overlord/snapstate/component.go b/overlord/snapstate/component.go index f5fd69f1460..f3a1a78b548 100644 --- a/overlord/snapstate/component.go +++ b/overlord/snapstate/component.go @@ -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)) diff --git a/overlord/snapstate/component_install_test.go b/overlord/snapstate/component_install_test.go index 794e5594555..40379fdc9de 100644 --- a/overlord/snapstate/component_install_test.go +++ b/overlord/snapstate/component_install_test.go @@ -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 {