Merge ~lutostag/layer-snap:revision_arg into ~stub/layer-snap:master

Proposed by Greg Lutostanski
Status: Merged
Merged at revision: cf3d4f624a169419c986cf9e95ddaef2d8031bea
Proposed branch: ~lutostag/layer-snap:revision_arg
Merge into: ~stub/layer-snap:master
Diff against target: 22 lines (+3/-1)
1 file modified
lib/charms/layer/snap.py (+3/-1)
Reviewer Review Type Date Requested Status
Stuart Bishop Approve
Review via email: mp+318245@code.launchpad.net

Description of the change

Allow a revision arg.

I am planning on making a small snap-action layer that will allow users to install specific revisions of snaps.

Essentially this is so that OIL can change juju snap revisions on demand via an action.

I thought this might be an addition to the base snap-layer that others may want in the future.

Thanks!

To post a comment you must log in.
Revision history for this message
Stuart Bishop (stub) wrote :

Yes, we need this.

I'll update the docs to match.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/charms/layer/snap.py b/lib/charms/layer/snap.py
2index b2fc2b9..0ab005a 100644
3--- a/lib/charms/layer/snap.py
4+++ b/lib/charms/layer/snap.py
5@@ -105,7 +105,7 @@ def connect_all():
6
7 def _snap_args(channel='stable', devmode=False, jailmode=False,
8 dangerous=False, force_dangerous=False, connect=None,
9- classic=False):
10+ classic=False, revision=None):
11 if channel != 'stable':
12 yield '--channel={}'.format(channel)
13 if devmode is True:
14@@ -116,6 +116,8 @@ def _snap_args(channel='stable', devmode=False, jailmode=False,
15 yield '--dangerous'
16 if classic is True:
17 yield '--classic'
18+ if revision is not None:
19+ yield '--revision={}'.format(revision)
20
21
22 def _install_local(path, **kw):

Subscribers

People subscribed via source and target branches