diff -Nru codetree-0.1.5/codetree/handlers/charm.py codetree-0.1.5/codetree/handlers/charm.py --- codetree-0.1.5/codetree/handlers/charm.py 2017-07-04 09:47:21.000000000 +0000 +++ codetree-0.1.5/codetree/handlers/charm.py 2017-09-04 09:31:41.000000000 +0000 @@ -56,8 +56,11 @@ downloader = _CharmStoreCharmDownloader(self.source, channel) else: downloader = _CharmStoreHttpDownloader(self.source, self.base_url, channel) - self.charmstore_url = downloader.resolve() + # Per https://github.com/juju/charm-tools/issues/337, we have to + # use specific revisions of charms. + downloader.source = self.charmstore_url + if os.path.exists(dest): if options.get("overwrite"): # Remove the directory even if it was previously a bzr or git @@ -120,7 +123,7 @@ """ meta_url = "{}/{}/meta/id?channel={}".format(self.base_url, self.source, self.channel) try: - self.charmstore_url = requests.get(meta_url).json()["Id"] + self.charmstore_url = requests.get(meta_url).json()["Id"][3:] except KeyError: raise NoSuchCharm('Could not find {!r} charm in the {!r} channel'.format(self.source, self.channel)) return self.charmstore_url @@ -145,12 +148,8 @@ :param download_dir: The directory to download to :return: The full path of the downloaded zip file """ - # Remove 'cs:' to get expanded URL, which we actually want to use - # for the download - expanded_url = self.charmstore_url[3:] - # Download (and verify SSL) - req = requests.get("{}/{}/archive".format(self.base_url, expanded_url)) + req = requests.get("{}/{}/archive".format(self.base_url, self.charmstore_url)) zip_path = os.path.join(download_dir, 'charm.zip') with open(zip_path, 'wb') as charm_file: for chunk in req.iter_content(8192): diff -Nru codetree-0.1.5/debian/bzr-builder.manifest codetree-0.1.5/debian/bzr-builder.manifest --- codetree-0.1.5/debian/bzr-builder.manifest 2017-07-04 09:47:21.000000000 +0000 +++ codetree-0.1.5/debian/bzr-builder.manifest 2017-09-04 09:31:41.000000000 +0000 @@ -1,2 +1,2 @@ -# bzr-builder format 0.3 deb-version {debupstream}-0~96 -lp:codetree revid:tom.haddon@canonical.com-20170704093543-152z0b278hbxf6xp +# bzr-builder format 0.3 deb-version {debupstream}-0~97 +lp:codetree revid:tom.haddon@canonical.com-20170904092756-4p5tl81igr988g8i diff -Nru codetree-0.1.5/debian/changelog codetree-0.1.5/debian/changelog --- codetree-0.1.5/debian/changelog 2017-07-04 09:47:21.000000000 +0000 +++ codetree-0.1.5/debian/changelog 2017-09-04 09:31:41.000000000 +0000 @@ -1,8 +1,8 @@ -codetree (0.1.5-0~96~ubuntu16.04.1) xenial; urgency=low +codetree (0.1.5-0~97~ubuntu16.04.1) xenial; urgency=low * Auto build. - -- Vincent Ladeuil Tue, 04 Jul 2017 09:47:21 +0000 + -- Vincent Ladeuil Mon, 04 Sep 2017 09:31:41 +0000 codetree (0.1.5-6) trusty; urgency=medium diff -Nru codetree-0.1.5/tests/test_charm_handler.py codetree-0.1.5/tests/test_charm_handler.py --- codetree-0.1.5/tests/test_charm_handler.py 2017-07-04 09:47:21.000000000 +0000 +++ codetree-0.1.5/tests/test_charm_handler.py 2017-09-04 09:31:41.000000000 +0000 @@ -135,7 +135,7 @@ assert self.cs.get(dest, {'overwrite': True}) _get.assert_called_with(self.get_url) expected_logging = [call("Downloading {} from charm store to {}".format(self.cs.source, dest)), - call("{} charm retrieved from cs:trusty/charm".format(dest))] + call("{} charm retrieved from trusty/charm".format(dest))] self.assertEqual(_logging.call_args_list, expected_logging) _logging.reset_mock() @@ -218,8 +218,8 @@ assert _check_output.call_count == 2 expected_request_args = [ call(('charm', 'show', '--format=json', '--channel', 'stable', 'cs:trusty/charm', 'id'), stderr=subprocess.STDOUT, universal_newlines=True), - call(('charm', 'pull', '--channel', 'stable', 'cs:trusty/charm', dest), stderr=subprocess.STDOUT, universal_newlines=True)] + call(('charm', 'pull', '--channel', 'stable', 'cs:trusty/charm-10', dest), stderr=subprocess.STDOUT, universal_newlines=True)] assert _check_output.call_args_list == expected_request_args - expected_logging = [call("Downloading {} from charm store to {}".format(self.cs.source, dest)), + expected_logging = [call("Downloading cs:trusty/charm-10 from charm store to {}".format(dest)), call("{} charm retrieved from {}".format(dest, self.cs.charmstore_url))] self.assertEqual(_logging.call_args_list, expected_logging)