Skip to content

Commit

Permalink
kolla-images.py: Fix container to image tag lookup corner case
Browse files Browse the repository at this point in the history
The failing case was the haproxy image used by the neutron_tls_proxy
container, if a tag is defined for the 'neutron' prefix but not
'haproxy'.
  • Loading branch information
markgoddard committed Jan 29, 2024
1 parent 0337190 commit 0bdc266
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tools/kolla-images.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,18 @@ def get_parent_tag_name(kolla_image_tags: KollaImageTags, base_distro: Optional[
"""Return the parent tag variable for a container in the tag variable hierarchy."""

if container in CONTAINER_TO_PREFIX_VAR_EXCEPTIONS:
parent = CONTAINER_TO_PREFIX_VAR_EXCEPTIONS[container]
if parent in kolla_image_tags:
return parent
prefix_var = CONTAINER_TO_PREFIX_VAR_EXCEPTIONS[container]
if prefix_var in kolla_image_tags:
return prefix_var
else:
prefix_var = container

def tag_key(tag):
"""Return a sort key to order the tags."""
if tag == "openstack":
# This is the default tag.
return 0
elif tag != container and container.startswith(tag) and (base_distro is None or base_distro in kolla_image_tags[tag]):
elif tag != prefix_var and prefix_var.startswith(tag) and (base_distro is None or base_distro in kolla_image_tags[tag]):
# Prefix match - sort by the longest match.
return -len(tag)
else:
Expand Down

0 comments on commit 0bdc266

Please sign in to comment.