I have a python app that I am trying to migrate to Snapcraft. One feature of this app is that part of the uninstall process is a request for the user to provide a reason they are uninstalling. So the user needs to have an interface pop up with a field they can type a reason into for uninstalling. They submit it, it gets sent to our servers, and then the app finishes uninstalling.
According to this other thread, the
uninstall hook will not work for this. However, my app had several timers and they appear to continue running after a finished Snapcraft uninstall of my app. I don’t know if this is intended by Snapcraft’s authors, but I figured I could take advantage of it.
I now have a timer that checks for the existence of the
os.environ['SNAP'] directory. If it is gone, the app assumes an uninstall has occurred, and the timer pops up a form window asking why the user uninstalled. They answer the question, hit submit, it sends to my servers, and my code then cleans up the remaining processes.
Everything works really well from my perspective, except on Ubuntu in
strict mode. The process works fine on Ubuntu in
devmode, just not
strict. Fedora is great in
devmode, Manjaro is great, a custom Arch install is great, but Ubuntu in
strict mode doesn’t seem to want to send the data to my server. It pops up the window just fine, gets the response from the user, and cleans everything up afterwards, but it gives this error whenever I try to send the data to the server:
Failed to establish a new connection: [Errno 13] Permission denied
My best guess is that the
network-bind plugs have been turned off with uninstall, and the network is thus completely inaccessible to the (Snapcraft assumes) fully uninstalled app.
So the short version of my question is, how can I accomplish what I want to accomplish here, having a popup on uninstall that asks the user why, and sends it to my servers?
Additionally, it might be helpful to know why it works great on Fedora and Arch and Manjaro, and universally in
devmode, but not on Ubuntu in
strict. And, is there a way to enable the network access for the remaining app processes after uninstall on Ubuntu in
strict, to make it like the other environments?