Merge lp:~bac/codetree/channels into lp:codetree

Proposed by Brad Crittenden
Status: Merged
Merged at revision: 72
Proposed branch: lp:~bac/codetree/channels
Merge into: lp:codetree
Diff against target: 72 lines (+14/-7)
3 files modified
README.md (+4/-3)
codetree/handlers/charm.py (+8/-2)
tests/test_charm_handler.py (+2/-2)
To merge this branch: bzr merge lp:~bac/codetree/channels
Reviewer Review Type Date Requested Status
Barry Price Approve
Review via email: mp+305376@code.launchpad.net

Description of the change

Recently the names of the channels supported by the charmstore changed to match those used by the snap store. They are now unpublished, edge, beta, candidate, and stable (in order of maturity).

This branch updates codetree to reflect those new names.

To post a comment you must log in.
Revision history for this message
Barry Price (barryprice) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README.md'
2--- README.md 2016-08-05 20:55:01 +0000
3+++ README.md 2016-09-09 19:05:37 +0000
4@@ -26,7 +26,7 @@
5 app2 git+ssh://git@github.com/me/app2.git
6 app3 git+https://github.com/me/my3rdapp.git
7 mycharm cs:trusty/mycharm
8- othercharm cs:trusty/othercharm;channel=development
9+ othercharm cs:trusty/othercharm;channel=edge
10
11 Taking that line-by-line:
12
13@@ -38,7 +38,7 @@
14 * app/mytag is a git checkout of the git repository from github at the tag 'mytag'
15 * app2 is also a git checkout but using a different format for the git url
16 * app3 is another git checkout but using the https style git url understood by codetree
17-* mycharm is a Juju charm from the [charm store](https://jujucharms.com/)
18+* mycharm is a Juju charm from the [charm store](https://jujucharms.com/)
19
20 ### Source URLs
21
22@@ -76,4 +76,5 @@
23 **Charm Store Only**
24 base_url: By default it is assumed to be the public store 'https://api.jujucharms.com/charmstore/v5' so few will need to modify this. Note only https is always supported.
25
26-channel: By default it is assumed to be the stable channel, you can specify 'stable', 'development', or unpublished. Note that because there is no charmstore auth at the moment they must be granted read access to everyone.
27+channel: By default it is assumed to be the stable channel, you can specify 'unpublished', 'edge', 'beta', 'candidate', or 'stable'. Note that because there is no charmstore auth at the moment they must be granted read access to everyone.
28+
29
30=== modified file 'codetree/handlers/charm.py'
31--- codetree/handlers/charm.py 2016-08-29 04:51:36 +0000
32+++ codetree/handlers/charm.py 2016-09-09 19:05:37 +0000
33@@ -11,6 +11,9 @@
34 from exceptions import InvalidOption, NoSuchCharm
35
36
37+SUPPORTED_CHANNELS = ('unpublished', 'edge', 'beta', 'candidate', 'stable')
38+
39+
40 class CharmStoreHandler(SourceHandler):
41 """Download plain files via https"""
42
43@@ -62,8 +65,11 @@
44 if urlparse(self.base_url).scheme != 'https':
45 raise InvalidOption('Only https is supported for Charm Store base_url')
46 channel = options.get("channel", "stable")
47- if channel not in ['stable', 'development', 'unpublished']:
48- raise InvalidOption('Only stable/development/unpublished is supported for Charm Store channel')
49+ if channel not in SUPPORTED_CHANNELS:
50+ channel_list = ', '.join(SUPPORTED_CHANNELS)
51+ msg = 'Channel "{}" is invalid. Must be one of: {}.'.format(
52+ channel, channel_list)
53+ raise InvalidOption(msg)
54 if os.path.exists(dest):
55 if options.get("overwrite"):
56 # Remove the directory even if it was previously a bzr or git
57
58=== modified file 'tests/test_charm_handler.py'
59--- tests/test_charm_handler.py 2016-08-29 04:45:23 +0000
60+++ tests/test_charm_handler.py 2016-09-09 19:05:37 +0000
61@@ -133,9 +133,9 @@
62 dest = os.path.join(self.tdir, 'test_download')
63 _get.return_value = MockedReq()
64
65- assert self.cs.get(dest, {'channel': 'development'})
66+ assert self.cs.get(dest, {'channel': 'edge'})
67 assert _get.call_count == 2
68- expected_request_args = [call('{}/trusty/charm/meta/id?channel=development'.format(self.cs.base_url)),
69+ expected_request_args = [call('{}/trusty/charm/meta/id?channel=edge'.format(self.cs.base_url)),
70 call('{}/trusty/charm/archive'.format(self.cs.base_url))]
71 assert _get.call_args_list == expected_request_args
72 expected_logging = [call("Downloading {} from charm store to {}".format(self.cs.source, dest)),

Subscribers

People subscribed via source and target branches