Files
Oliver Calder 4714253f45 features: add function to return info about feature flags
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>
2024-03-14 08:39:09 +01:00
..