Skip to content

Commit

Permalink
Add abstraction for debian repo
Browse files Browse the repository at this point in the history
  • Loading branch information
dosas authored and ogajduse committed Nov 21, 2023
1 parent e39ce21 commit 4f16526
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions robottelo/constants/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ class Colored(Box):
SYNC_INTERVAL = {'hour': "hourly", 'day': "daily", 'week': "weekly", 'custom': "custom cron"}

REPO_TYPE = {
"deb": "deb",
'yum': "yum",
'ostree': "ostree",
'docker': "docker",
Expand Down
47 changes: 47 additions & 0 deletions robottelo/host_helpers/repository_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,53 @@ class FileRepository(BaseRepository):
_type = constants.REPO_TYPE['file']


class DebianRepository(BaseRepository):
"""Custom Debian repository."""

_type = constants.REPO_TYPE["deb"]

def __init__(
self, url=None, distro=None, content_type=None, deb_errata_url=None, deb_releases=None
):
super().__init__(url=url, distro=distro, content_type=content_type)
self._deb_errata_url = deb_errata_url
self._deb_releases = deb_releases

@property
def deb_errata_url(self):
return self._deb_errata_url

@property
def deb_releases(self):
return self._deb_releases

def create(
self,
organization_id,
product_id,
download_policy=None,
synchronize=True,
):
"""Create the repository for the supplied product id"""
create_options = {
'product-id': product_id,
'content-type': self.content_type,
'url': self.url,
'deb-releases': self._deb_releases,
}

if self._deb_errata_url is not None:
create_options['deb-errata-url'] = self._deb_errata_url

repo_info = self.satellite.cli_factory.make_repository(create_options)
self._repo_info = repo_info

if synchronize:
self.synchronize()

return repo_info


class DockerRepository(BaseRepository):
"""Custom Docker repository"""

Expand Down

0 comments on commit 4f16526

Please sign in to comment.