[RFE] Define safe_install method that sets flag snap.failed.install when install/refresh fails instead of raise exception

Bug #1838660 reported by Pedro Guimarães
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Snap Layer
New
Undecided
Unassigned

Bug Description

Installing charms that depend layer-snap may cause transient "error" status because command "snap install" or "snap refresh" failed to fetch .snap file from snapstore.

Charms pick-up and eventually finish installation if network is OK. However, juju-wait monitors for charms that error and returns if it finds one. That transient status ends up breaking automations we have that build on top of juju-wait or we need to exclude relevant charms from juju-wait monitor.

"snap install" and "snap refresh" happens only on install method on this charm. This method will raise an exception if snap call fails. We could have a second method (say, safe_install) that captures subprocess.CalledProcessError and defines a flag (say "snap.failed.install") when this flag is capture. That way, upper layers can manage and message this error without breaking automation (e.g. setting status to "waiting")

This method needs to remove this flag at beginning of its logic.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.