in dnf/artifact-registry.py [0:0]
def config(self):
""" Setup http headers to repos with baseurl option containing pkg.dev. """
for repo in self.base.repos.iter_enabled():
# Check if the 'artifact_registry_oauth' option is set in the repository's config.
if repo.cfg.has_option(repo.id, 'artifact_registry_oauth') and repo.cfg.getboolean(repo.id, 'artifact_registry_oauth'):
self._add_headers(repo)
break # Don't add more than one Authorization header.
# We don't have baseurl option so skip it earlier.
if not hasattr(repo, 'baseurl'):
continue
# Check if any repo urls are for Artifact Registry.
for baseurl in repo.baseurl:
if not self.error: # Check error flag first for efficiency
parsed_url = urlparse(baseurl)
if parsed_url.scheme == 'https' and parsed_url.netloc.endswith('-yum.pkg.dev'):
self._add_headers(repo)
break # Don't add more than one Authorization header.