Merge "Fix ks_template property to be processed only for anaconda deploy"

This commit is contained in:
Zuul 2023-07-26 17:06:12 +00:00 committed by Gerrit Code Review
commit 40356e2eae

View File

@ -664,11 +664,12 @@ def get_instance_image_info(task, ipxe_enabled=False):
""" """
ctx = task.context ctx = task.context
node = task.node node = task.node
boot_option = deploy_utils.get_boot_option(node)
image_info = {} image_info = {}
# NOTE(pas-ha) do not report image kernel and ramdisk for # NOTE(pas-ha) do not report image kernel and ramdisk for
# local boot or whole disk images so that they are not cached # local boot or whole disk images so that they are not cached
if (node.driver_internal_info.get('is_whole_disk_image') if (node.driver_internal_info.get('is_whole_disk_image')
or deploy_utils.get_boot_option(node) == 'local'): or boot_option == 'local'):
return image_info return image_info
root_dir = _get_root_dir(ipxe_enabled) root_dir = _get_root_dir(ipxe_enabled)
i_info = node.instance_info i_info = node.instance_info
@ -697,7 +698,9 @@ def get_instance_image_info(task, ipxe_enabled=False):
# like is done with basically Glance. # like is done with basically Glance.
labels = ('kernel', 'ramdisk') labels = ('kernel', 'ramdisk')
if not isap: if boot_option != 'kickstart':
anaconda_labels = ()
elif not isap:
anaconda_labels = ('stage2', 'ks_template', 'ks_cfg') anaconda_labels = ('stage2', 'ks_template', 'ks_cfg')
else: else:
# When a path is used, a stage2 ramdisk can be determiend # When a path is used, a stage2 ramdisk can be determiend
@ -744,30 +747,32 @@ def get_instance_image_info(task, ipxe_enabled=False):
else: else:
node.set_driver_internal_info( node.set_driver_internal_info(
'stage2', str(image_properties['stage2_id'])) 'stage2', str(image_properties['stage2_id']))
# NOTE(TheJulia): A kickstart template is entirely independent
# of the stage2 ramdisk. In the end, it was the configuration which if 'ks_template' in anaconda_labels:
# told anaconda how to execute. # NOTE(TheJulia): A kickstart template is entirely independent
if i_info.get('ks_template'): # of the stage2 ramdisk. In the end, it was the configuration which
# If the value is set, we always overwrite it, in the event # told anaconda how to execute.
# a rebuild is occuring or something along those lines. if i_info.get('ks_template'):
node.set_driver_internal_info('ks_template', # If the value is set, we always overwrite it, in the event
i_info['ks_template']) # a rebuild is occuring or something along those lines.
else: node.set_driver_internal_info('ks_template',
_get_image_properties() i_info['ks_template'])
# ks_template is an optional property on the image
if image_properties and 'ks_template' in image_properties:
node.set_driver_internal_info(
'ks_template', str(image_properties['ks_template']))
else: else:
# If not defined, default to the overall system default _get_image_properties()
# kickstart template, as opposed to a user supplied # ks_template is an optional property on the image
# template. if image_properties and 'ks_template' in image_properties:
node.set_driver_internal_info( node.set_driver_internal_info(
'ks_template', 'ks_template', str(image_properties['ks_template']))
'file://' + os.path.abspath( else:
CONF.anaconda.default_ks_template # If not defined, default to the overall system default
# kickstart template, as opposed to a user supplied
# template.
node.set_driver_internal_info(
'ks_template',
'file://' + os.path.abspath(
CONF.anaconda.default_ks_template
)
) )
)
node.save() node.save()