Handling uninstallation upon subordinate removal in reactive

Stuart Bishop stuart.bishop at canonical.com
Tue Nov 28 00:11:56 UTC 2017

On 22 November 2017 at 01:58, Junien Fridrick
<junien.fridrick at canonical.com> wrote:

> I was also thinking that maybe the snap layer could save which
> application installed which snap, and if said application is removed,
> then remove said snap. Would that be a good idea ?

Your subordinate charm doesn't know it is the only charm using the
snap on that unit, so it is dangerous doing this sort of cleanup.
Well, right now it is pretty safe because snaps in charms are rare but
I expect this to change over time. It is exactly the same as
automatically removing deb packages, which charms rarely if ever do.
Also note that snaps can contain data, and removing them can destroy
this data. subordinates need to tread lightly to avoid victimizing
other charms on the unit, and primary charms don't bother because
removing them means the machine should ideally be rebuilt.

It would be possible to have the snap layer automatically remove
snaps, but the behaviour would need to be explicitly enabled using a
layer.yaml option.

Stuart Bishop <stuart.bishop at canonical.com>

More information about the Juju mailing list