Merge ~stub/layer-snap:defer-refresh into ~stub/layer-snap:master

Proposed by Stuart Bishop
Status: Merged
Merged at revision: 62d918f8979451128af93973aa57635e19287fee
Proposed branch: ~stub/layer-snap:defer-refresh
Merge into: ~stub/layer-snap:master
Diff against target: 0 lines
Reviewer Review Type Date Requested Status
Kevin W Monroe (community) Approve
Review via email: mp+349246@code.launchpad.net

Commit message

Defer setting refresh times until the core snap is installed

To post a comment you must log in.
Revision history for this message
Kevin W Monroe (kwmonroe) wrote :

I had to call in the big guns and ask @cory_fu why the need for register_trigger vs an @when(config.changed.x). He explained the conflict with multiple layers potentially handling the config changed flags. This is a nice and TIL. Thanks!

review: Approve
Revision history for this message
Stuart Bishop (stub) wrote :

Its actually because config.changed.snapd_refresh and snap.installed.core may not be set in the same hook, so the handler will never run (eg. config was set on initial deploy, but no snaps installed until a particular relation has been joined). Which is why there are proposals to change the lifecycle of the config.changed.* flags, which would give the snap control over the lifecycle of the config.changed.snapd_refresh flag, and would allow me to use the simpler @when syntax ;) The trigger pattern avoids the confusion altogether, and quickly becomes obvious when you see it used a few times.

Preview Diff

Empty

Subscribers

People subscribed via source and target branches

to all changes: