Пример #1
0
 def fetch(self, dir_):
     url = self.EXTRA_INFO_URL.format(self.entity)
     repo_url = get(url).json().get('bzr-url')
     if repo_url:
         try:
             fetcher = fetchers.get_fetcher(repo_url)
         except fetchers.FetchError:
             log.debug("No fetcher for %s, downloading from charmstore",
                       repo_url)
             return super(CharmstoreRepoDownloader, self).fetch(dir_)
         else:
             return fetcher.fetch(dir_)
     return super(CharmstoreRepoDownloader, self).fetch(dir_)
Пример #2
0
 def fetch(self, dir_):
     url = self.EXTRA_INFO_URL.format(self.entity)
     repo_url = get(url).json().get('bzr-url')
     if repo_url:
         try:
             fetcher = fetchers.get_fetcher(repo_url)
         except fetchers.FetchError:
             log.debug(
                 "No fetcher for %s, downloading from charmstore",
                 repo_url)
             return super(CharmstoreRepoDownloader, self).fetch(dir_)
         else:
             return fetcher.fetch(dir_)
     return super(CharmstoreRepoDownloader, self).fetch(dir_)
Пример #3
0
 def fetch(self, dir_):
     for cfg in self.LAYER_CONFIGS:
         url = '{}/{}'.format(self.ARCHIVE_URL.format(self.entity), cfg)
         result = get(url)
         if not result.ok:
             continue
         repo_url = yaml.safe_load(result.text).get('repo')
         if not repo_url:
             continue
         try:
             fetcher = fetchers.get_fetcher(repo_url)
         except fetchers.FetchError:
             log.debug(
                 'Charm %s has a repo set in %s, but no fetcher could '
                 'be found for the repo (%s).', self.entity, cfg, repo_url)
             break
         else:
             return fetcher.fetch(dir_)
     return super(CharmstoreLayerDownloader, self).fetch(dir_)
Пример #4
0
 def fetch(self, dir_):
     for cfg in self.LAYER_CONFIGS:
         url = '{}/{}'.format(
             self.ARCHIVE_URL.format(self.entity), cfg)
         result = get(url)
         if not result.ok:
             continue
         repo_url = yaml.safe_load(result.text).get('repo')
         if not repo_url:
             continue
         try:
             fetcher = fetchers.get_fetcher(repo_url)
         except fetchers.FetchError:
             log.debug(
                 'Charm %s has a repo set in %s, but no fetcher could '
                 'be found for the repo (%s).', self.entity, cfg, repo_url)
             break
         else:
             return fetcher.fetch(dir_)
     return super(CharmstoreLayerDownloader, self).fetch(dir_)