if context.config.mirror:
return None
- pattern = "etc/pki/entitlement/*.pem"
-
- p = next((p for p in sorted(context.sandbox_tree.glob(pattern)) if "key" not in p.name), None)
- if not p:
- p = next((p for p in sorted(Path("/").glob(pattern)) if "key" not in p.name), None)
- if not p:
- die("Entitlement certificate not found in host system or sandbox tree")
+ glob = "/etc/pki/entitlement/*.pem"
+ paths = [p for p in glob_in_sandbox(glob, sandbox=context.sandbox()) if "-key.pem" not in p.name]
+ if not paths:
+ die(
+ f"No entitlement certificates found at {glob} in sandbox",
+ hint="Add an entitlement certificate to the sandbox with SandboxTrees= or mkosi.sandbox/",
+ )
- return p
+ return paths[0]
@classmethod
- def repository_variants(cls, context: Context, repo: str) -> Iterable[RpmRepository]:
+ def repository_variants(
+ cls,
+ context: Context,
+ gpgurls: tuple[str, ...],
+ repo: str,
+ ) -> Iterable[RpmRepository]:
if context.config.local_mirror:
- yield RpmRepository(repo, f"baseurl={context.config.local_mirror}", cls.gpgurls(context))
+ yield RpmRepository(repo, f"baseurl={context.config.local_mirror}", gpgurls)
else:
mirror = context.config.mirror or "https://cdn.redhat.com/content/dist/"