Skip to content

Commit 9e011fc

Browse files
committed
Add missing get_full_path function and import
1 parent 8a0de1b commit 9e011fc

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

pulp_container/app/registry_api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
determine_media_type,
8282
extract_data_from_signature,
8383
filter_resource,
84+
get_full_path,
8485
has_task_completed,
8586
validate_manifest,
8687
)

pulp_container/app/utils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from functools import partial
88

99
from asgiref.sync import sync_to_async
10+
from django.conf import settings
1011
from django.db import IntegrityError
1112
from jsonschema import Draft7Validator, ValidationError, validate
1213
from pysequoia.packet import PacketPile, Tag
@@ -34,6 +35,13 @@
3435
log = logging.getLogger(__name__)
3536

3637

38+
def get_full_path(base_path, pulp_domain=None):
39+
if settings.DOMAIN_ENABLED:
40+
domain = pulp_domain or get_domain()
41+
return f"{domain.name}/{base_path}"
42+
return base_path
43+
44+
3745
def get_accepted_media_types(headers):
3846
"""
3947
Returns a list of media types from the Accept headers.

pulp_container/tests/functional/conftest.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,3 +501,16 @@ def _check_manifest_arch_os_size(manifest):
501501
assert any(manifest.compressed_image_size > 0 for manifest in manifests)
502502

503503
return _check_manifest_arch_os_size
504+
505+
506+
@pytest.fixture(scope="session")
507+
def full_path(pulp_settings):
508+
def _full_path(base_path_or_distro, pulp_domain="default"):
509+
if not isinstance(base_path_or_distro, str):
510+
pulp_domain = base_path_or_distro.pulp_href[len(pulp_settings.API_ROOT) :].split("/")[0]
511+
base_path_or_distro = base_path_or_distro.base_path
512+
if pulp_settings.DOMAIN_ENABLED:
513+
return f"{pulp_domain}/{base_path_or_distro}"
514+
return base_path_or_distro
515+
516+
return _full_path

0 commit comments

Comments
 (0)