Skip to content

Commit 87129c8

Browse files
authored
Skip UUID resolution for image URLs in conductor config (#1542)
The conductor configuration now preserves image URLs instead of attempting to resolve them to OpenStack image UUIDs. This allows using external image sources like HTTP URLs for Ironic deployments. - Add validators dependency for robust URL/UUID validation - Replace custom is_uuid() function with validators.uuid() - Skip image resolution when value is already a URL or UUID - Affects image_source, deploy_kernel, and deploy_ramdisk parameters AI-assisted: Claude Code Signed-off-by: Christian Berendt <[email protected]>
1 parent 0599bb8 commit 87129c8

File tree

4 files changed

+60
-21
lines changed

4 files changed

+60
-21
lines changed

Pipfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ setuptools = "==80.9.0"
3535
sqlmodel = "==0.0.24"
3636
sushy = "==5.6.0"
3737
transitions = "==0.9.2"
38+
validators = "==0.35.0"
3839
watchdog = "==6.0.0"

Pipfile.lock

Lines changed: 48 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

osism/tasks/conductor/config.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
# SPDX-License-Identifier: Apache-2.0
22

3-
import uuid
4-
53
from loguru import logger
4+
import validators
65
import yaml
76

87
from osism.tasks import Config, openstack
98

109

11-
def is_uuid(value):
12-
"""Check if a string is a valid UUID."""
13-
try:
14-
uuid.UUID(value)
15-
return True
16-
except (ValueError, AttributeError):
17-
return False
18-
19-
2010
def get_configuration():
2111
with open("/etc/conductor.yml") as fp:
2212
configuration = yaml.load(fp, Loader=yaml.SafeLoader)
@@ -39,7 +29,9 @@ def get_configuration():
3929
image_source = configuration["ironic_parameters"]["instance_info"][
4030
"image_source"
4131
]
42-
if not is_uuid(image_source):
32+
if not validators.uuid(image_source) and not validators.url(
33+
image_source
34+
):
4335
result = openstack.image_get(image_source)
4436
if result:
4537
configuration["ironic_parameters"]["instance_info"][
@@ -53,7 +45,9 @@ def get_configuration():
5345
deploy_kernel = configuration["ironic_parameters"]["driver_info"][
5446
"deploy_kernel"
5547
]
56-
if not is_uuid(deploy_kernel):
48+
if not validators.uuid(deploy_kernel) and not validators.url(
49+
deploy_kernel
50+
):
5751
result = openstack.image_get(deploy_kernel)
5852
if result:
5953
configuration["ironic_parameters"]["driver_info"][
@@ -68,7 +62,9 @@ def get_configuration():
6862
deploy_ramdisk = configuration["ironic_parameters"]["driver_info"][
6963
"deploy_ramdisk"
7064
]
71-
if not is_uuid(deploy_ramdisk):
65+
if not validators.uuid(deploy_ramdisk) and not validators.url(
66+
deploy_ramdisk
67+
):
7268
result = openstack.image_get(deploy_ramdisk)
7369
if result:
7470
configuration["ironic_parameters"]["driver_info"][

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@ sushy==5.6.0
3030
tabulate==0.9.0
3131
transitions==0.9.2
3232
uvicorn[standard]==0.35.0
33+
validators==0.35.0
3334
watchdog==6.0.0

0 commit comments

Comments
 (0)