diff --git a/data/interfaces/v1.py b/data/interfaces/v1.py index 8aeb2a008..055808f14 100644 --- a/data/interfaces/v1.py +++ b/data/interfaces/v1.py @@ -22,14 +22,6 @@ class DockerRegistryV1DataInterface(object): Interface that represents all data store interactions required by a Docker Registry v1. """ - @abstractmethod - def placement_locations_docker_v1(self, namespace_name, repo_name, image_id): - """ - Returns all the placements for the image with the given V1 Docker ID, found under the given - repository or None if no image was found. - """ - pass - @abstractmethod def placement_locations_and_path_docker_v1(self, namespace_name, repo_name, image_id): """ @@ -233,12 +225,6 @@ class PreOCIModel(DockerRegistryV1DataInterface): PreOCIModel implements the data model for the v1 Docker Registry protocol using a database schema before it was changed to support the OCI specification. """ - def placement_locations_docker_v1(self, namespace_name, repo_name, image_id): - repo_image = model.image.get_repo_image_and_storage(namespace_name, repo_name, image_id) - if repo_image is None or repo_image.storage is None: - return None - return repo_image.storage.locations - def placement_locations_and_path_docker_v1(self, namespace_name, repo_name, image_id): repo_image = model.image.get_repo_image_extended(namespace_name, repo_name, image_id) if not repo_image or repo_image.storage is None: diff --git a/endpoints/v1/registry.py b/endpoints/v1/registry.py index 9deb113b1..ea4f1f2e4 100644 --- a/endpoints/v1/registry.py +++ b/endpoints/v1/registry.py @@ -84,7 +84,7 @@ def head_image_layer(namespace, repository, image_id, headers): logger.debug('Checking repo permissions') if permission.can() or model.repository_is_public(namespace, repository): logger.debug('Looking up placement locations') - locations = model.placement_locations_docker_v1(namespace, repository, image_id) + locations, _ = model.placement_locations_and_path_docker_v1(namespace, repository, image_id) if locations is None: logger.debug('Could not find any blob placement locations') abort(404, 'Image %(image_id)s not found', issue='unknown-image', diff --git a/test/registry_tests.py b/test/registry_tests.py index 2892d4f7c..218f5576b 100644 --- a/test/registry_tests.py +++ b/test/registry_tests.py @@ -438,6 +438,10 @@ class V1RegistryPullMixin(V1RegistryMixin): response = self.conduct('GET', image_prefix + 'json', auth='sig') self.assertEquals(image_id, response.json()['id']) + # Ensure we can HEAD the image layer. + self.conduct('HEAD', image_prefix + 'layer', auth='sig') + + # And retrieve the layer data. response = self.conduct('GET', image_prefix + 'layer', auth='sig') # Ensure we can parse the layer bytes and that they contain the contents. @@ -1145,10 +1149,10 @@ class V2RegistryTests(V2RegistryPullMixin, V2RegistryPushMixin, RegistryTestsMix """ Tests for V2 registry. """ def test_numeric_tag(self): # Push a new repository. - self.do_push('public', 'newrepo', 'public', 'password', tag_name='1234') + self.do_push('public', 'new-repo', 'public', 'password', tag_name='1234') # Pull the repository. - self.do_pull('public', 'newrepo', 'public', 'password', manifest_id='1234') + self.do_pull('public', 'new-repo', 'public', 'password', manifest_id='1234') def test_label_invalid_manifest(self): images = [{