Skip to content

Commit

Permalink
Remove unused pulp-docker configs and function
Browse files Browse the repository at this point in the history
A while ago, Pulp authentication was refactored, and the pulp-docker
configurations became unused
(redhat-exd-rebuilds@1c87c52).

This commit removes an unused function in the pulp module, and the
related tests:

JIRA: CWFHEALTH-2084
  • Loading branch information
FernandesMF committed Aug 22, 2023
1 parent 31cc4ca commit e759b9c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 45 deletions.
18 changes: 0 additions & 18 deletions freshmaker/pulp.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,3 @@ def get_content_set_by_repo_ids(self, repo_ids):
}
repos = self._rest_post("repositories/search/", json.dumps(query_data))
return [repo["notes"]["content_set"] for repo in repos if "content_set" in repo["notes"]]

@retry(wait_on=requests.exceptions.RequestException)
def get_docker_repository_name(self, cdn_repo):
"""
Getting docker repository name from pulp using cdn repo name.
:param str cdn_repo: The CDN repo name from Errata Tool.
:rtype: str
:return: Docker repository name.
"""
response = self._rest_get("repositories/%s/" % cdn_repo, distributors=True)

docker_repository_name = None
for distributor in response["distributors"]:
if distributor["distributor_type_id"] == "docker_distributor_web":
docker_repository_name = distributor["config"]["repo-registry-id"]
break
return docker_repository_name
27 changes: 0 additions & 27 deletions tests/test_pulp.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,29 +162,6 @@ def test_get_content_sets_by_ignoring_nonexisting_ones(self, post):
self.assertEqual(['rhel-7-workstation-rpms', 'rhel-7-desktop-rpms'],
content_sets)

@patch('freshmaker.pulp.requests.get')
def test_get_docker_repository_name(self, get):
get.return_value.json.return_value = {
'display_name': 'foo-526',
'description': 'Foo',
'distributors': [
{'repo_id': 'foo-526',
'distributor_type_id': 'docker_distributor_web',
'config': {'repo-registry-id': 'scl/foo-526'}}
]
}

pulp = Pulp(self.server_url, cert=self.cert)
repo_name = pulp.get_docker_repository_name("foo-526")

get.assert_called_once_with(
'{}pulp/api/v2/repositories/foo-526/'.format(self.server_url),
params={"distributors": True},
cert=self.cert,
timeout=conf.requests_timeout)

self.assertEqual(repo_name, "scl/foo-526")

@patch('freshmaker.pulp.requests.post')
@patch('freshmaker.pulp.requests.get')
def test_retrying_calls(self, get, post):
Expand All @@ -193,10 +170,6 @@ def test_retrying_calls(self, get, post):

pulp = Pulp(self.server_url, cert=self.cert)

with self.assertRaises(exceptions.HTTPError):
pulp.get_docker_repository_name("test")
self.assertGreater(get.call_count, 1)

with self.assertRaises(exceptions.HTTPError):
pulp.get_content_set_by_repo_ids(['test1', 'test2'])
self.assertGreater(post.call_count, 1)

0 comments on commit e759b9c

Please sign in to comment.