Merge lp:~frankban/juju-quickstart/bundlelib-03 into lp:juju-quickstart

Proposed by Francesco Banconi
Status: Merged
Merged at revision: 144
Proposed branch: lp:~frankban/juju-quickstart/bundlelib-03
Merge into: lp:juju-quickstart
Diff against target: 93 lines (+20/-8)
3 files modified
quickstart/__init__.py (+1/-1)
quickstart/models/bundles.py (+15/-3)
tox.ini (+4/-4)
To merge this branch: bzr merge lp:~frankban/juju-quickstart/bundlelib-03
Reviewer Review Type Date Requested Status
Jay R. Wren (community) Approve
Review via email: mp+278328@code.launchpad.net

Description of the change

Update to use jujubundlelib 0.3.0.

To post a comment you must log in.
Revision history for this message
Jay R. Wren (evarlast) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'quickstart/__init__.py'
2--- quickstart/__init__.py 2015-10-27 10:14:10 +0000
3+++ quickstart/__init__.py 2015-11-23 14:58:55 +0000
4@@ -45,7 +45,7 @@
5 Once Juju has been installed, the command can also be run as a juju plugin,
6 without the hyphen ("juju quickstart").
7 """
8-VERSION = (2, 2, 2)
9+VERSION = (2, 2, 3)
10
11
12 def get_version():
13
14=== modified file 'quickstart/models/bundles.py'
15--- quickstart/models/bundles.py 2015-08-11 09:06:56 +0000
16+++ quickstart/models/bundles.py 2015-11-23 14:58:55 +0000
17@@ -239,15 +239,14 @@
18 # For this reason, we cannot infer the new bundle identifier from a
19 # charmworld URL: we instead need to try to fetch both references.
20 fullname = '{}-{}'.format(basket, name)
21- reference = references.Reference('cs', user, 'bundle', fullname, revision)
22+ reference = _reference_from_data(user, fullname, revision)
23 try:
24 data = charmstore.get_bundle_data(reference)
25 except charmstore.NotFoundError:
26 # Also try the case in which a single bundle was included in the
27 # legacy YAML. In this case, validating that the name was included
28 # in the original YAML is also required.
29- reference = references.Reference(
30- 'cs', user, 'bundle', basket, revision)
31+ reference = _reference_from_data(user, basket, revision)
32 # Validate the bundle name is included in the legacy data.
33 _flatten_data(charmstore.get_legacy_bundle_data(reference), name)
34 # Retrieve the new bundle data corresponding to the shorter reference.
35@@ -265,6 +264,19 @@
36 return Bundle(data, reference=reference)
37
38
39+def _reference_from_data(user, name, revision):
40+ """Instantiate a "jujubundlelib.references.Reference" from the given data.
41+
42+ Provide a backward compatibility layer between jujubundlelib 0.2.1 and
43+ 0.3.0.
44+ """
45+ try:
46+ # Try old version without channel.
47+ return references.Reference('cs', user, 'bundle', name, revision)
48+ except TypeError:
49+ return references.Reference('cs', user, '', 'bundle', name, revision)
50+
51+
52 def _retrieve_from_url(url):
53 """Retrieve bundle YAML content from the given URL.
54
55
56=== modified file 'tox.ini'
57--- tox.ini 2015-11-05 10:46:10 +0000
58+++ tox.ini 2015-11-23 14:58:55 +0000
59@@ -72,7 +72,7 @@
60 # See https://launchpad.net/~juju/+archive/ubuntu/stable.
61 websocket-client==0.18.0
62 jujuclient==0.50.3
63- jujubundlelib==0.2.1
64+ jujubundlelib==0.3.0
65 urwid==1.2.1
66 # The distribution PyYAML requirement is used in this case.
67
68@@ -82,7 +82,7 @@
69 # Ubuntu 14.04 (trusty) distro dependencies.
70 websocket-client==0.12.0
71 jujuclient==0.17.5
72- jujubundlelib==0.2.0
73+ jujubundlelib==0.3.0
74 PyYAML==3.10
75 urwid==1.1.1
76
77@@ -92,7 +92,7 @@
78 # Ubuntu 15.04 (vivid) distro dependencies.
79 websocket-client==0.18.0
80 jujuclient==0.18.5
81- jujubundlelib==0.2.0
82+ jujubundlelib==0.3.0
83 PyYAML==3.11
84 urwid==1.2.1
85
86@@ -102,7 +102,7 @@
87 # Ubuntu 15.10 (wily) distro dependencies.
88 websocket-client==0.18.0
89 jujuclient==0.50.1
90- jujubundlelib==0.2.0
91+ jujubundlelib==0.3.0
92 PyYAML==3.11
93 urwid==1.2.1
94

Subscribers

People subscribed via source and target branches