Skip to content

Prioritize exact matches, then prefix, then search terms#68

Merged
sergiocazzolato merged 1 commit intomainfrom
improve-image-find
Feb 10, 2026
Merged

Prioritize exact matches, then prefix, then search terms#68
sergiocazzolato merged 1 commit intomainfrom
improve-image-find

Conversation

@sergiocazzolato
Copy link
Contributor

Updated the image lookup logic for OpenStack to support a more robust matching strategy. Since OpenStack lacks a "family" concept similar to GCE, this PR introduces a prefix-based fallback to improve image discovery.

The matching is now performed in the following priority order:

  1. Exact Match: Returns immediately if the name matches perfectly.
  2. Prefix Match: If no exact match exists, finds all images starting with the name and selects the newest one.
  3. Term Match: If no prefix match exists, falls back to term-based matching and selects the newest one.

Updated the image lookup logic for OpenStack to support a more robust
matching strategy. Since OpenStack lacks a "family" concept similar to
GCE, this PR introduces a prefix-based fallback to improve image
discovery.

The matching is now performed in the following priority order:
1. Exact Match: Returns immediately if the name matches perfectly.
2. Prefix Match: If no exact match exists, finds all images starting
with the name and selects the newest one.
3. Term Match: If no prefix match exists, falls back to term-based
matching and selects the newest one.
Copy link
Collaborator

@maykathm maykathm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could have less code duplication by creating a function out of the second and third loops.

@sergiocazzolato sergiocazzolato merged commit 2d42e72 into main Feb 10, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants