Simple question: is it possible and/or legitimate for a running snap to trigger a manual refresh of itself?
In our case we have a snap that runs a background service written in python, which does some processing and also periodically checks in with an API on our end. In some cases, when we release a new version of the snap we’d like to have a way to tell a client device to “update itself” to this new version, potentially ahead of the scheduled refresh. We can send this signal by setting a flag in the API, but I was wondering what - if anything - the client device should do to carry out the actual refresh. E.g. would just executing a shell command
snap refresh <snap_name>
be a sensible thing to do? Or maybe hitting the
snapd API, e.g. https://github.com/snapcore/snapd/wiki/REST-API#post-v2snaps (
though not sure how exactly authentication would be handled there EDIT: looks like the root user, which is what the script is running under, can access the API without authentication).
Any tips or advice would be appreciated!