@@ -298,7 +298,6 @@ func delayedCrossMgrInit() {
298298 snapstate .SeedRefreshTasks = SeedRefreshTasks
299299 snapstate .UpdateSeedRefreshChange = UpdateSeedRefreshChange
300300 snapstate .CheckSeedRefreshRemove = CheckSeedRefreshRemove
301- snapstate .CheckComponentSeedRefreshRemove = CheckComponentSeedRefreshRemove
302301}
303302
304303// proxyStore returns the store assertion for the proxy store if one is set.
@@ -1862,40 +1861,21 @@ func appendSeedRefreshCandidate(create *state.Task, snapSetupTasks []string, com
18621861 return setTaskRecoverySystemSetup (create , setup )
18631862}
18641863
1865- // CheckSeedRefreshRemove prevents removing optional snaps that are still
1866- // present in the current seed while seed-refresh is enabled.
1864+ // CheckSeedRefreshRemove prevents removing optional snaps and components that
1865+ // are still present in the current seed while seed-refresh is enabled.
18671866//
18681867// TODO:SEEDREFRESH: remove this once we support seed-refresh seeds
18691868// gaining/losing snaps
1870- func CheckSeedRefreshRemove (st * state.State , si * snap. Info , dctx snapstate.DeviceContext ) error {
1869+ func CheckSeedRefreshRemove (st * state.State , candidate snapstate. SeedRefreshCandidate , dctx snapstate.DeviceContext ) error {
18711870 filter := seedRefreshFilter (st , dctx )
1872- _ , seedRefreshTriggered , err := filter (snapstate.SeedRefreshCandidate {
1873- InstanceName : si .SnapName (),
1874- })
1875- if err != nil {
1876- return err
1877- }
1871+ _ , seedRefreshTriggered , err := filter (candidate )
18781872
1879- if seedRefreshTriggered {
1880- return errors .New ("cannot remove snap present in the current seed while seed-refresh is enabled" )
1881- }
1882- return nil
1883- }
1884-
1885- // CheckComponentSeedRefreshRemove is set by devicestate to prevent removal of
1886- // components that must remain present for seed-refresh.
1887- var CheckComponentSeedRefreshRemove = func (st * state.State , si * snap.Info , componentName string , dctx snapstate.DeviceContext ) error {
1888- filter := seedRefreshFilter (st , dctx )
1889- _ , seedRefreshTriggered , err := filter (snapstate.SeedRefreshCandidate {
1890- InstanceName : si .SnapName (),
1891- ComponentSetupTaskIDs : map [string ]string {componentName : "" },
1892- })
18931873 if err != nil {
18941874 return err
18951875 }
18961876
18971877 if seedRefreshTriggered {
1898- return errors .New ("cannot remove component present in the current seed while seed-refresh is enabled" )
1878+ return errors .New ("cannot remove snap present in the current seed while seed-refresh is enabled" )
18991879 }
19001880 return nil
19011881}
0 commit comments