Merge pull request #7597 from anonymouse64/bugfix/snap-svcs-disable-fix-4
overlord/snapstate: add LastActiveDisabledServices, missingDisabledServices
* Add LastActiveDisabledServices to SnapState.
This field will be used for saving disabled services in the following situations:
When we have removed systemd units for a snap during a refresh, revert, or disable and thus systemd can no longer remember if the service was disabled or not.
When we have refreshed, or reverted to a revision of the snap where a service that was previously present and disabled is no longer present in the snap and thus can't be disabled.
Note we need the second situation because if one disables a service, then refreshes to a revision where the service was renamed, and we revert back to the previous revision due to some problem, that previously disabled service will be erroneously enabled.
This is specifically not a current list of what services are enabled/disabled.
* Add missingDisabledServices to snapstate
This helper splits a list of disabled services (really the one saved in SnapState) into services which are present in the current snap Info (and thus should be disabled and deleted from state right now), and those which are missing from the current snap Info and should be saved in state for going to a different revision at some unknown point in the future.
Merge pull request #7643 from bboozzoo/bboozzoo/devicestate-split-files
overlord/devicestate: refactor and split into per-functionality files, drop dead code
As a prerequisite for the remodel work, attempt to refactor and split the
current code into files based on functionality. This should prevent
uncontrollable growth of devicestate and avoid the issues we have with
snapstate.
Couple of TODOs:
* looking at content handlers_test.go could be renamed to handlers_remodel_test.go
* the various TestDoRequestSerial* could go into a handlers_serial_test.go
There is some reordering that could be done in devicestate_test.go.