Browse Source

Handle containers without a namespace

Satellite server does not include a namespace when exposing containers.
This change fixes our image-serve metadata creation to understand this
concept and build the _catalog we provide correctly. We will only handle
two types of containers path structures with the image-serve.

   * host:port/namespace/container:tag
   * host:port/container:tag

Change-Id: I259a0d5fcbae8f8a6bbeffa5fdb744d3291315ad
Depends-On: https://review.opendev.org/c/openstack/tripleo-ansible/+/775158
Closes-Bug: #1913782
(cherry picked from commit 7e797317a3)
changes/07/775107/1
Alex Schultz 4 months ago
parent
commit
7d7a983caa
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      tripleo_common/image/image_export.py

+ 6
- 1
tripleo_common/image/image_export.py View File

@ -382,12 +382,17 @@ def build_catalog():
catalog_entries = []
LOG.debug('Rebuilding %s' % catalog_path)
images_path = os.path.join(IMAGE_EXPORT_DIR, 'v2')
metadata_set = set(['blobs', 'manifests', 'tags'])
for namespace in os.listdir(images_path):
namespace_path = os.path.join(images_path, namespace)
if not os.path.isdir(namespace_path):
continue
for image in os.listdir(namespace_path):
contents_set = set(os.listdir(namespace_path))
# handle containers with no namespaces
if metadata_set.issubset(contents_set):
catalog_entries.append(namespace)
for image in list(contents_set - metadata_set):
catalog_entries.append('%s/%s' % (namespace, image))
catalog = {'repositories': catalog_entries}


Loading…
Cancel
Save