Merge ~xavpaice/layer-snap:bug/1919246 into ~stub/layer-snap:master

Proposed by Xav Paice
Status: Merged
Merged at revision: 1873ad4cf7d9928fff249c7f508c0042eb818440
Proposed branch: ~xavpaice/layer-snap:bug/1919246
Merge into: ~stub/layer-snap:master
Diff against target: 17 lines (+1/-1)
1 file modified
reactive/snap.py (+1/-1)
Reviewer Review Type Date Requested Status
Stuart Bishop Approve
Cory Johns (community) Approve
Review via email: mp+399697@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Xav Paice (xavpaice) wrote :

Cory - I need to understand better the reason that 'hookenv.atstart(check_refresh_available)' was added in 2d3872544653c2fcec4a9b57d594d976b7fd1042 (Add support for snap coherence) and if we can avoid running the refresh check every hook execution.

Revision history for this message
Cory Johns (johnsca) wrote :

It was added to support handlers being triggered (via a flag) when a snap had a pending refresh available. The primary use-case was to allow for a cohort manager, such as kubernetes-master, to check whether any of the cohorts it was managing had updates [1]. However, it was subsequently realized [2] that using `snap refresh --list` doesn't work if the cohort manager is managing snaps that it doesn't have installed itself, and so we're no longer using it. If there's no other need to trigger handlers based on pending refreshes (and I can't think of any others), then I think it's fine to remove it.

[1]: https://github.com/charmed-kubernetes/charm-kubernetes-master/pull/61
[2]: https://github.com/charmed-kubernetes/charm-kubernetes-master/pull/125

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

If charms turn out to be using this, they can temporarily add back the hookenv.atstart(check_refresh_available) call themselves and we can revisit their use case.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/reactive/snap.py b/reactive/snap.py
2index 557eb84..1fda7b7 100644
3--- a/reactive/snap.py
4+++ b/reactive/snap.py
5@@ -105,6 +105,7 @@ def refresh():
6 # It probably should live in the base layer, blocking the charm
7 # during bootstrap if the arch is unsupported.
8 arch = uname()[4]
9+ check_refresh_available()
10 for snapname, snap_opts in opts.items():
11 supported_archs = snap_opts.pop("supported-architectures", None)
12 if supported_archs and arch not in supported_archs:
13@@ -346,4 +347,3 @@ hookenv.atstart(ensure_path)
14 hookenv.atstart(update_snap_proxy)
15 hookenv.atstart(configure_snap_store_proxy)
16 hookenv.atstart(install)
17-hookenv.atstart(check_refresh_available)

Subscribers

People subscribed via source and target branches

to all changes: