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/+/773968
Closes-Bug: #1913782
(cherry picked from commit 7e797317a3
)
This commit is contained in:
parent
fd744a86fe
commit
0193f55647
|
@ -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…
Reference in New Issue