diff --git a/packit/copr_helper.py b/packit/copr_helper.py index 61ad66795..374777190 100644 --- a/packit/copr_helper.py +++ b/packit/copr_helper.py @@ -4,7 +4,7 @@ import logging import time from datetime import datetime, timedelta -from typing import Callable, List, Optional, Dict, Tuple, Any +from typing import Callable, List, Optional, Dict, Tuple, Any, Set from cachetools.func import ttl_cache from copr.v3 import Client as CoprClient @@ -396,3 +396,19 @@ def get_repo_download_url(self, owner: str, project: str, chroot: str) -> str: raise PackitCoprProjectException( f"There is no such target {chroot} in {owner}/{project}." ) + + def get_chroots(self, owner: str, project: str) -> Set[str]: + """ + Get chroots set on a specific project. + + Args: + owner: Owner of the Copr project. + project: Name of the Copr project. + + Returns: + Set of all enabled chroots on the requested Copr project. + """ + copr_project = self.copr_client.project_proxy.get( + ownername=owner, projectname=project + ) + return set(copr_project.chroot_repos.keys())