Fix incorrect handling/update about deprecated parameters

This is a follow-up of 3864e15998 and
fixes the following point.

- ipxe_enabled parameter was deprecated during Xena cycle. The logic
  to purge the parameter was added to remove the parameter during
  update and should be kept during Xena.

- We should not pass undef directly to *_config resource because it
  results in an empty value in configuration files. We should replace
  the value by $::os_service_default to remove that parameter.

- It is recommended to gather deprecated parameters in one place
  in parameter definition block.

Change-Id: I02aadb4501c124e3373fe0d98453fc755ec82500
This commit is contained in:
Takashi Kajinami 2021-07-23 01:12:04 +09:00
parent 1904baa3cc
commit b307c40f35
2 changed files with 6 additions and 2 deletions

View File

@ -118,7 +118,6 @@
# Defaults to $::os_service_default.
#
class ironic::drivers::pxe (
$ipxe_enabled = undef,
$pxe_append_params = $::os_service_default,
$pxe_bootfile_name = $::os_service_default,
$pxe_config_template = $::os_service_default,
@ -136,6 +135,8 @@ class ironic::drivers::pxe (
$enable_ppc64le = false,
$boot_retry_timeout = $::os_service_default,
$boot_retry_check_interval = $::os_service_default,
# DEPRECATED PARAMETERS
$ipxe_enabled = undef,
$ip_version = undef,
) {
@ -149,6 +150,7 @@ class ironic::drivers::pxe (
if $ip_version != undef {
warning('The ironic::drivers::pxe:ip_version parameter is deprecated and will be removed in the future.')
}
$ip_version_real = pick($ip_version, $::os_service_default)
# Configure ironic.conf
ironic_config {
@ -168,7 +170,8 @@ class ironic::drivers::pxe (
'pxe/ipxe_timeout': value => $ipxe_timeout;
'pxe/boot_retry_timeout': value => $boot_retry_timeout;
'pxe/boot_retry_check_interval': value => $boot_retry_check_interval;
'pxe/ip_version': value => $ip_version;
'pxe/ipxe_enabled': ensure => absent;
'pxe/ip_version': value => $ip_version_real;
}
if $enable_ppc64le {

View File

@ -50,6 +50,7 @@ describe 'ironic::drivers::pxe' do
is_expected.to contain_ironic_config('pxe/uefi_pxe_bootfile_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('pxe/uefi_pxe_config_template').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('pxe/uefi_ipxe_bootfile_name').with_value('snponly.efi')
is_expected.to contain_ironic_config('pxe/ipxe_enabled').with_ensure('absent')
end
context 'when overriding only enable_ppc64le' do