Investigate get-openstack-image as is not able to get metadata for a second image

Summary

During the activation of a secondary image, the get-openstack-images is not able to pull metadata for a second image

Steps to reproduce

You just need to enable two images in your values:

sylva_diskimagebuilder_images:
  ubuntu-jammy-hardened-rke2-1-29-9:
    default_enabled: true
  ubuntu-jammy-plain-rke2-1-28-14:
    enabled: true

What is the current bug behavior?

The second image won't be pushed and you will not be able to progress on the deployment.

What is the expected correct behavior?

The second image should be push on the openstack and the image should be available to be used for cluster deployment.

Relevant logs and/or screenshots

first image - where things are good

 ": "/v2/images?visibility=community&marker=e6f3521b-1baf-4ad7-a8d7-0ba294818a7a"}
2024-12-18 09:02:00,724 DEBUG keystoneauth.session request: GET call to image for https://172.20.136.36:13004/v2/images?visibility=community used request id req-3efbfd3c-075f-4ba5-b5cb-97dc9f19f690
2024-12-18 09:02:00,786 WARNING __main__ image_exists_in_glance: Image with name 'ubuntu-jammy-hardened-rke2-1-29-9-sylva-diskimage-builder-0.3.3' already exists.
2024-12-18 09:02:00,787 INFO __main__ <module>: Image already in Glance: ubuntu-jammy-hardened-rke2-1-29-9 with MD5 checksum 26205ddd8f5868e6b9be095617eff025
2024-12-18 09:02:00,787 INFO __main__ <module>: Existing image details - Name: ubuntu-jammy-hardened-rke2-1-29-9-sylva-diskimage-builder-0.3.3, UUID: 736301db-237f-4a0f-8bbb-1af8571bd0d3
2024-12-18 09:02:00,789 DEBUG urllib3.connectionpool _new_conn: Starting new HTTPS connection (1): registry.gitlab.com:443
2024-12-18 09:02:01,165 DEBUG urllib3.connectionpool _make_request: https://registry.gitlab.com:443 "GET /v2/sylva-projects/sylva-elements/diskimage-builder/ubuntu-jammy-hardened-rke2-1-29-9/manifests/0.3.3 HTTP/11" 401 241
2024-12-18 09:02:01,166 DEBUG oras.logger text_handler: Requesting anon token with params: {'service': 'container_registry', 'scope': 'repository:sylva-projects/sylva-elements/diskimage-builder/ubuntu-jammy-hardened-rke2-1-29-9:pull'}
2024-12-18 09:02:01,169 DEBUG urllib3.connectionpool _new_conn: Starting new HTTPS connection (1): gitlab.com:443
2024-12-18 09:02:01,541 DEBUG urllib3.connectionpool _make_request: https://gitlab.com:443 "GET /jwt/auth?service=container_registry&scope=repository%3Asylva-projects%2Fsylva-elements%2Fdiskimage-builder%2Fubuntu-jammy-hardened-rke2-1-29-9%3Apull HTTP/11" 200 None
2024-12-18 09:02:01,542 DEBUG oras.logger text_handler: Successfully obtained anonymous token!
2024-12-18 09:02:01,670 DEBUG urllib3.connectionpool _make_request: https://registry.gitlab.com:443 "GET /v2/sylva-projects/sylva-elements/diskimage-builder/ubuntu-jammy-hardened-rke2-1-29-9/manifests/0.3.3 HTTP/11" 200 1542

second image

2024-12-18 09:02:01,938 INFO __main__ <module>: image not in Glance: ubuntu-jammy-plain-rke2-1-28-14 / md5 285dddc1296106e490c49cfd2a76f474
2024-12-18 09:02:01,938 INFO __main__ <module>: Pulling image: ubuntu-jammy-plain-rke2-1-28-14 from artifact uri: oci://registry.gitlab.com/sylva-projects/sylva-elements/diskimage-builder/ubuntu-jammy-plain-rke2-1-28-14:0.3.3 to /tmp/tmpfvh8xqq2
2024-12-18 09:02:02,060 DEBUG urllib3.connectionpool _make_request: https://registry.gitlab.com:443 "GET /v2/sylva-projects/sylva-elements/diskimage-builder/ubuntu-jammy-plain-rke2-1-28-14/manifests/0.3.3 HTTP/11" 401 239
2024-12-18 09:02:02,185 DEBUG urllib3.connectionpool _make_request: https://registry.gitlab.com:443 "GET /v2/sylva-projects/sylva-elements/diskimage-builder/ubuntu-jammy-plain-rke2-1-28-14/manifests/0.3.3 HTTP/11" 401 239
2024-12-18 09:02:02,187 ERROR oras.logger text_handler: 

Possible fixes

the oras.client initialization https://gitlab.com/sylva-projects/sylva-core/-/blob/1.2.1/kustomize-units/get-openstack-images/get-openstack-images.py?ref_type=tags#L308 need to be moved inside the for after line 310

Edited by Thomas Morin