mirror of
https://github.com/token2/snapd.git
synced 2026-03-13 11:15:47 -07:00
Add `All()` function, which returns a map of feature names to `FeatureInfo` structs. `FeatureInfo` contains boolean values for whether the feature is supported and whether it is enabled. A new map is defined from feature flags to callback functions which return true if the feature is supported and false if it is unsupported. Any feature for which no callback function is defined is assumed to be supported. Currently, callback functions are defined for `QuotaGroups` (check that systemd version >= 230), `UserDaemons` (check that user units are supported), and `AppArmorPrompting` (always return false, for now). Since some components of prompting are not yet merged into snapd master, the experimental "apparmor-prompting" feature is not yet supported. This commit adds a callback for "apparmor-prompting" which returns false and states that it requires a newer version of snapd. Once the rest of the prompting system is ready, the callback for AppArmorPrompting should be modified to instead check that the installed AppArmor has kernel and parser support for prompting, and that the notify socket for communicating with the kernel exists. Any features which are set to values other than true or false are omitted from the map returned by `All()`. Signed-off-by: Oliver Calder <oliver.calder@canonical.com> features: add unsupported reason when feature not supported Signed-off-by: Oliver Calder <oliver.calder@canonical.com> features: improved docstrings for `All()` and `FeatureInfo` Signed-off-by: Oliver Calder <oliver.calder@canonical.com> features: adjusted callback feature unsupported reasons Signed-off-by: Oliver Calder <oliver.calder@canonical.com> features: add supported callback for apparmor prompting Signed-off-by: Oliver Calder <oliver.calder@canonical.com>