It would be great to see the gate-auto-refresh
hook documented along with the other hooks in Supported snap hooks and wherever that page migrated to in the ReadTheDocs.
I have a few questions at the moment:
- Does the
gate-auto-refresh
hook run before or after thepre-refresh
hook? And if it runs before but setssnapctl refresh --hold
, does that prevent thepre-refresh
hook from running? - How does
snapctl refresh --hold
andsnapctl refresh --proceed
called from within hooks/scripts interact with settings the user has set withsnap refresh --hold <snapname>
? If the user has set a hold, is the snap capable of un-holding itself (I assume that would be bad)? - I’m curious about the output of
snapctl refresh --pending
: does it return “inhibited” if there was asnapctl refresh --hold
and/orsnap refresh --hold <snapname>
? - What happens when
snapctl refresh --proceed
is called? Does it immediately trigger a refresh (assuming a previous refresh was held by agate-auto-refresh
hook call tosnapctl refresh --hold
)? Does thegate-auto-refresh
hook get run again, and/or thepre-refresh
hook? - If the snap refresh is inhibited by a hold on one of its dependencies, what happens if
snapctl refresh --proceed
is called? I assume it still doesn’t proceed until the dependency is un-held?
I think refresh control could be an excellent solution to the problem of creating e.g. database backups before performing a refresh. There’s a timeout in the pre-refresh
hook (30s I believe), so if the database backup would take too long, it could be killed and the refresh would fail. I think the gate-auto-refresh
hook could be used to avoid this by holding the refresh, triggering a backup service to run separately, then that backup script would run snapctl refresh --proceed
when it’s done creating the backup.