Snap health¶
Since version 2.41, snapd
supports health status checks for snaps via the check-health
hook.
When implementing hooks with snap-helpers
, it’s possible to set the health
status for the snap via SnapHealth
.
This provides methods for each of the supported health statuses:
>>> from snaphelpers import SnapHealth >>> health = SnapHealth() >>> health.okay() >>> health.waiting('foo must happen first', code='wait-foo') >>> health.blocked('nothing to do for now') >>> health.error('something is wrong', code='bar-wrong')
Note that for any status other than okay
, a message is required. Error code
is optional.