Merge lp:~frankban/juju-quickstart/new-bundle-lib-no-bundle into lp:juju-quickstart

Proposed by Francesco Banconi
Status: Merged
Merged at revision: 147
Proposed branch: lp:~frankban/juju-quickstart/new-bundle-lib-no-bundle
Merge into: lp:juju-quickstart
Diff against target: 199 lines (+31/-18)
7 files modified
quickstart/__init__.py (+1/-1)
quickstart/charmstore.py (+1/-1)
quickstart/models/bundles.py (+3/-1)
quickstart/tests/models/test_bundles.py (+2/-1)
quickstart/tests/test_charmstore.py (+19/-9)
quickstart/tests/test_manage.py (+1/-1)
tox.ini (+4/-4)
To merge this branch: bzr merge lp:~frankban/juju-quickstart/new-bundle-lib-no-bundle
Reviewer Review Type Date Requested Status
Fabrice Matrat Approve
Review via email: mp+279412@code.launchpad.net

Description of the change

Update to juju-bundlelib 0.4.1.

To post a comment you must log in.
Revision history for this message
Fabrice Matrat (fabricematrat) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'quickstart/__init__.py'
--- quickstart/__init__.py 2015-11-23 14:57:26 +0000
+++ quickstart/__init__.py 2015-12-03 09:56:35 +0000
@@ -45,7 +45,7 @@
45Once Juju has been installed, the command can also be run as a juju plugin,45Once Juju has been installed, the command can also be run as a juju plugin,
46without the hyphen ("juju quickstart").46without the hyphen ("juju quickstart").
47"""47"""
48VERSION = (2, 2, 3)48VERSION = (2, 2, 4)
4949
5050
51def get_version():51def get_version():
5252
=== modified file 'quickstart/charmstore.py'
--- quickstart/charmstore.py 2015-04-21 10:22:46 +0000
+++ quickstart/charmstore.py 2015-12-03 09:56:35 +0000
@@ -142,7 +142,7 @@
142 Raise an IOError if any other problems occur while communicating with the142 Raise an IOError if any other problems occur while communicating with the
143 charm store.143 charm store.
144 """144 """
145 if not reference.is_bundle():145 if reference.series and not reference.is_bundle():
146 raise ValueError(146 raise ValueError(
147 b'expected a bundle, provided charm {}'.format(reference))147 b'expected a bundle, provided charm {}'.format(reference))
148 content = get_reference(reference, path)148 content = get_reference(reference, path)
149149
=== modified file 'quickstart/models/bundles.py'
--- quickstart/models/bundles.py 2015-11-30 11:18:19 +0000
+++ quickstart/models/bundles.py 2015-12-03 09:56:35 +0000
@@ -176,6 +176,8 @@
176 raise176 raise
177177
178 # The source refers to a bundle URL in jujucharms.com.178 # The source refers to a bundle URL in jujucharms.com.
179 if not reference.series:
180 reference.series = 'bundle'
179 try:181 try:
180 data = charmstore.get_bundle_data(reference)182 data = charmstore.get_bundle_data(reference)
181 except charmstore.NotFoundError as err:183 except charmstore.NotFoundError as err:
@@ -252,7 +254,7 @@
252 reference.charmworld_id = url[len('bundle:'):]254 reference.charmworld_id = url[len('bundle:'):]
253 logging.warn(255 logging.warn(
254 'this bundle URL is deprecated: please use the new format: '256 'this bundle URL is deprecated: please use the new format: '
255 '{}'.format(reference.jujucharms_id()))257 '{}'.format(reference.copy(series='').jujucharms_id()))
256 return Bundle(data, reference=reference)258 return Bundle(data, reference=reference)
257259
258260
259261
=== modified file 'quickstart/tests/models/test_bundles.py'
--- quickstart/tests/models/test_bundles.py 2015-11-30 11:18:19 +0000
+++ quickstart/tests/models/test_bundles.py 2015-12-03 09:56:35 +0000
@@ -344,7 +344,8 @@
344 def test_jujucharms_bundle_invalid_url(self):344 def test_jujucharms_bundle_invalid_url(self):
345 # A ValueError is raised if the provided jujucharms.com identifier is345 # A ValueError is raised if the provided jujucharms.com identifier is
346 # not valid.346 # not valid.
347 with self.assert_value_error('invalid bundle URL: u/no/such/bundle/!'):347 expected_error = 'invalid charm or bundle URL: u/no/such/bundle/!'
348 with self.assert_value_error(expected_error):
348 bundles.from_source('u/no/such/bundle/!')349 bundles.from_source('u/no/such/bundle/!')
349350
350 def test_jujucharms_bundle_invalid_content(self):351 def test_jujucharms_bundle_invalid_content(self):
351352
=== modified file 'quickstart/tests/test_charmstore.py'
--- quickstart/tests/test_charmstore.py 2015-04-21 10:22:46 +0000
+++ quickstart/tests/test_charmstore.py 2015-12-03 09:56:35 +0000
@@ -88,7 +88,17 @@
88 content = charmstore.get_reference(ref, '/meta/hash')88 content = charmstore.get_reference(ref, '/meta/hash')
89 self.assertEqual('hash', content)89 self.assertEqual('hash', content)
90 mock_urlread.assert_called_once_with(90 mock_urlread.assert_called_once_with(
91 settings.CHARMSTORE_API + 'bundle/mediawiki-single/meta/hash')91 settings.CHARMSTORE_API + 'mediawiki-single/meta/hash')
92
93 def test_success_bundle(self):
94 # A GET request to the charm store is correctly performed using the
95 # given bundle reference.
96 ref = references.Reference.from_jujucharms_url('django/bundle')
97 with self.patch_urlread(contents='hash') as mock_urlread:
98 content = charmstore.get_reference(ref, '/meta/hash')
99 self.assertEqual('hash', content)
100 mock_urlread.assert_called_once_with(
101 settings.CHARMSTORE_API + 'bundle/django/meta/hash')
92102
93 def test_success_without_leading_slash(self):103 def test_success_without_leading_slash(self):
94 # The resulting URL is correctly formatted when the static path does104 # The resulting URL is correctly formatted when the static path does
@@ -120,8 +130,7 @@
120 with self.assertRaises(charmstore.NotFoundError) as ctx:130 with self.assertRaises(charmstore.NotFoundError) as ctx:
121 charmstore.get_reference(ref, '/no/such')131 charmstore.get_reference(ref, '/no/such')
122 expected_error = (132 expected_error = (
123 'charm store resource not found at '133 'charm store resource not found at {}django/no/such: '
124 '{}bundle/django/no/such: '
125 'bad wolf'.format(settings.CHARMSTORE_API))134 'bad wolf'.format(settings.CHARMSTORE_API))
126 self.assertEqual(expected_error, bytes(ctx.exception))135 self.assertEqual(expected_error, bytes(ctx.exception))
127136
@@ -190,7 +199,7 @@
190199
191 def test_data_retrieved(self):200 def test_data_retrieved(self):
192 # The bundle data is correctly retrieved and parsed.201 # The bundle data is correctly retrieved and parsed.
193 ref = references.Reference.from_jujucharms_url('django/42')202 ref = references.Reference.from_jujucharms_url('django/bundle/42')
194 with self.patch_urlread(contents=self.bundle_content) as mock_urlread:203 with self.patch_urlread(contents=self.bundle_content) as mock_urlread:
195 data = charmstore.get_bundle_data(ref)204 data = charmstore.get_bundle_data(ref)
196 self.assertEqual(self.bundle_data, data)205 self.assertEqual(self.bundle_data, data)
@@ -205,7 +214,7 @@
205 charmstore.get_bundle_data(ref)214 charmstore.get_bundle_data(ref)
206 expected_error = (215 expected_error = (
207 'cannot communicate with the charm store at '216 'cannot communicate with the charm store at '
208 '{}bundle/mediawiki-single/archive/bundle.yaml: '217 '{}mediawiki-single/archive/bundle.yaml: '
209 'bad wolf'.format(settings.CHARMSTORE_API))218 'bad wolf'.format(settings.CHARMSTORE_API))
210 self.assertEqual(expected_error, bytes(ctx.exception))219 self.assertEqual(expected_error, bytes(ctx.exception))
211220
@@ -217,7 +226,7 @@
217 charmstore.get_bundle_data(ref)226 charmstore.get_bundle_data(ref)
218 expected_error = (227 expected_error = (
219 'charm store resource not found at '228 'charm store resource not found at '
220 '{}bundle/no-such/archive/bundle.yaml: '229 '{}no-such/archive/bundle.yaml: '
221 'bad wolf'.format(settings.CHARMSTORE_API))230 'bad wolf'.format(settings.CHARMSTORE_API))
222 self.assertEqual(expected_error, bytes(ctx.exception))231 self.assertEqual(expected_error, bytes(ctx.exception))
223232
@@ -246,7 +255,8 @@
246255
247 def test_data_retrieved(self):256 def test_data_retrieved(self):
248 # The legacy bundle data is correctly retrieved and parsed.257 # The legacy bundle data is correctly retrieved and parsed.
249 ref = references.Reference.from_jujucharms_url('u/who/django/42')258 ref = references.Reference.from_jujucharms_url(
259 'u/who/django/bundle/42')
250 contents = self.legacy_bundle_content260 contents = self.legacy_bundle_content
251 with self.patch_urlread(contents=contents) as mock_urlread:261 with self.patch_urlread(contents=contents) as mock_urlread:
252 data = charmstore.get_legacy_bundle_data(ref)262 data = charmstore.get_legacy_bundle_data(ref)
@@ -263,13 +273,13 @@
263 charmstore.get_legacy_bundle_data(ref)273 charmstore.get_legacy_bundle_data(ref)
264 expected_error = (274 expected_error = (
265 'cannot communicate with the charm store at '275 'cannot communicate with the charm store at '
266 '{}bundle/mediawiki-single/archive/bundles.yaml.orig: '276 '{}mediawiki-single/archive/bundles.yaml.orig: '
267 'bad wolf'.format(settings.CHARMSTORE_API))277 'bad wolf'.format(settings.CHARMSTORE_API))
268 self.assertEqual(expected_error, bytes(ctx.exception))278 self.assertEqual(expected_error, bytes(ctx.exception))
269279
270 def test_not_found_error(self):280 def test_not_found_error(self):
271 # Not found errors are properly propagated.281 # Not found errors are properly propagated.
272 ref = references.Reference.from_jujucharms_url('no-such')282 ref = references.Reference.from_jujucharms_url('no-such/bundle')
273 with self.patch_urlread(error=netutils.NotFoundError('bad wolf')):283 with self.patch_urlread(error=netutils.NotFoundError('bad wolf')):
274 with self.assertRaises(charmstore.NotFoundError) as ctx:284 with self.assertRaises(charmstore.NotFoundError) as ctx:
275 charmstore.get_legacy_bundle_data(ref)285 charmstore.get_legacy_bundle_data(ref)
276286
=== modified file 'quickstart/tests/test_manage.py'
--- quickstart/tests/test_manage.py 2015-10-28 16:45:58 +0000
+++ quickstart/tests/test_manage.py 2015-12-03 09:56:35 +0000
@@ -661,7 +661,7 @@
661 with mock.patch('sys.stderr', new_callable=io.StringIO) as mock_stderr:661 with mock.patch('sys.stderr', new_callable=io.StringIO) as mock_stderr:
662 self.call_setup(['invalid/bundle!'], exit_called=False)662 self.call_setup(['invalid/bundle!'], exit_called=False)
663 expected_error = (663 expected_error = (
664 'error: unable to open the bundle: invalid bundle URL: '664 'error: unable to open the bundle: invalid charm or bundle URL: '
665 'invalid/bundle!')665 'invalid/bundle!')
666 self.assertIn(expected_error, mock_stderr.getvalue())666 self.assertIn(expected_error, mock_stderr.getvalue())
667667
668668
=== modified file 'tox.ini'
--- tox.ini 2015-11-30 09:18:47 +0000
+++ tox.ini 2015-12-03 09:56:35 +0000
@@ -72,7 +72,7 @@
72 # See https://launchpad.net/~juju/+archive/ubuntu/stable.72 # See https://launchpad.net/~juju/+archive/ubuntu/stable.
73 websocket-client==0.18.073 websocket-client==0.18.0
74 jujuclient==0.50.374 jujuclient==0.50.3
75 jujubundlelib==0.3.275 jujubundlelib==0.4.1
76 urwid==1.2.176 urwid==1.2.1
77 # The distribution PyYAML requirement is used in this case.77 # The distribution PyYAML requirement is used in this case.
7878
@@ -82,7 +82,7 @@
82 # Ubuntu 14.04 (trusty) distro dependencies.82 # Ubuntu 14.04 (trusty) distro dependencies.
83 websocket-client==0.12.083 websocket-client==0.12.0
84 jujuclient==0.17.584 jujuclient==0.17.5
85 jujubundlelib==0.3.285 jujubundlelib==0.4.1
86 PyYAML==3.1086 PyYAML==3.10
87 urwid==1.1.187 urwid==1.1.1
8888
@@ -92,7 +92,7 @@
92 # Ubuntu 15.04 (vivid) distro dependencies.92 # Ubuntu 15.04 (vivid) distro dependencies.
93 websocket-client==0.18.093 websocket-client==0.18.0
94 jujuclient==0.18.594 jujuclient==0.18.5
95 jujubundlelib==0.3.295 jujubundlelib==0.4.1
96 PyYAML==3.1196 PyYAML==3.11
97 urwid==1.2.197 urwid==1.2.1
9898
@@ -102,7 +102,7 @@
102 # Ubuntu 15.10 (wily) distro dependencies.102 # Ubuntu 15.10 (wily) distro dependencies.
103 websocket-client==0.18.0103 websocket-client==0.18.0
104 jujuclient==0.50.1104 jujuclient==0.50.1
105 jujubundlelib==0.3.2105 jujubundlelib==0.4.1
106 PyYAML==3.11106 PyYAML==3.11
107 urwid==1.2.1107 urwid==1.2.1
108108

Subscribers

People subscribed via source and target branches