Comment 1 for bug 2058505

Revision history for this message
Alex Kavanagh (ajkavanagh) wrote :

Good bit of sleuthing!

I think there's a couple of ways that this could be solved.

1) prevent the function from being called by using a 'gating' flag or similar; i.e. after the service is enable, set a flag that it is enabled. This is a bit tricky as it's essentially caching metadata about the real world, and that may change, whilst the flag stays the same (i.e. an external actor may disable the service).
2) my preference; make the `enable_services` function both idempotent (which is sort of is) but add additional logic to not do the enable for a service if it is already enabled. This will maintain the 'self-repair' aspect of the charm function, but lose the annoying side-effects of continually enabling a service.