示例#1
0
 async def run(self):
     """
     Build and emit `DeclarativeContent` from the ansible metadata.
     """
     async with ProgressReport(
         message="Parsing Role Metadata", code="sync.parsing.metadata"
     ) as pb:
         async for metadata in self._fetch_roles():
             for version in metadata["summary_fields"]["versions"]:
                 url = GITHUB_URL % (
                     metadata["github_user"],
                     metadata["github_repo"],
                     version["name"],
                 )
                 role = Role(
                     version=version["name"],
                     name=metadata["name"],
                     namespace=metadata["namespace"],
                 )
                 relative_path = "%s/%s/%s.tar.gz" % (
                     metadata["namespace"],
                     metadata["name"],
                     version["name"],
                 )
                 d_artifact = DeclarativeArtifact(
                     artifact=Artifact(),
                     url=url,
                     relative_path=relative_path,
                     remote=self.remote,
                     deferred_download=self.deferred_download,
                 )
                 d_content = DeclarativeContent(content=role, d_artifacts=[d_artifact])
                 await pb.aincrement()
                 await self.put(d_content)
示例#2
0
 async def run(self):
     """
     Build and emit `DeclarativeContent` from the ansible metadata.
     """
     with ProgressBar(message='Parsing Role Metadata') as pb:
         async for metadata in self._fetch_roles():
             for version in metadata['summary_fields']['versions']:
                 url = GITHUB_URL % (
                     metadata['github_user'],
                     metadata['github_repo'],
                     version['name'],
                 )
                 role = Role(version=version['name'],
                             name=metadata['name'],
                             namespace=metadata['namespace'])
                 relative_path = "%s/%s/%s.tar.gz" % (
                     metadata['namespace'],
                     metadata['name'],
                     version['name'],
                 )
                 d_artifact = DeclarativeArtifact(
                     artifact=Artifact(),
                     url=url,
                     relative_path=relative_path,
                     remote=self.remote,
                     deferred_download=self.deferred_download,
                 )
                 d_content = DeclarativeContent(
                     content=role,
                     d_artifacts=[d_artifact],
                 )
                 pb.increment()
                 await self.put(d_content)