From 7c2fb19c95a37ea74ce5a6290e94de739fe99732 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 2 Nov 2023 00:01:57 +0900 Subject: [PATCH] inspector: Ensure valid elements for kernel args The following parameters only accept string values and a different type such as array can result in wrongly rendered template file. - ramdisk_collectors - ramdisk_filename - kernel_filename - ramdisk_kernel_args In additionl the following parameters can't accept empty strings. - ramdisk_collectors - ramdisk_filename - kernel_filename Change-Id: I0787d2c2b9eacb51ef02d1c1cb7cbda895755b19 --- manifests/inspector.pp | 10 +++++----- spec/classes/ironic_inspector_spec.rb | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/manifests/inspector.pp b/manifests/inspector.pp index 5596fd90..da5d0d99 100644 --- a/manifests/inspector.pp +++ b/manifests/inspector.pp @@ -134,7 +134,7 @@ # # [*ramdisk_kernel_args*] # String with kernel arguments to send to the ramdisk on boot. -# Defaults to undef +# Defaults to '' # # [*ramdisk_filename*] # The filename of ramdisk which is used in pxelinux_cfg/ipxelinux_cfg templates @@ -220,11 +220,11 @@ class ironic::inspector ( $dnsmasq_dhcp_hostsdir = undef, $dnsmasq_log_facility = undef, Boolean $sync_db = true, - $ramdisk_collectors = 'default', - $ramdisk_filename = 'agent.ramdisk', - $kernel_filename = 'agent.kernel', + String[1] $ramdisk_collectors = 'default', + String[1] $ramdisk_filename = 'agent.ramdisk', + String[1] $kernel_filename = 'agent.kernel', $additional_processing_hooks = undef, - $ramdisk_kernel_args = undef, + String $ramdisk_kernel_args = '', $ipxe_timeout = $facts['os_service_default'], $http_port = '8088', $detect_boot_mode = $facts['os_service_default'], diff --git a/spec/classes/ironic_inspector_spec.rb b/spec/classes/ironic_inspector_spec.rb index 33611824..0a00371e 100644 --- a/spec/classes/ironic_inspector_spec.rb +++ b/spec/classes/ironic_inspector_spec.rb @@ -271,7 +271,7 @@ describe 'ironic::inspector' do 'content' => /ipxe/, ) is_expected.to contain_file('/var/www/httpboot/inspector.ipxe').with_content( - /kernel http:\/\/192.168.0.1:3816\/agent.kernel ipa-inspection-callback-url=http:\/\/192.168.0.1:5050\/v1\/continue ipa-inspection-collectors=default.* foo=bar || goto retry_boot/ + /kernel http:\/\/192.168.0.1:3816\/agent.kernel ipa-inspection-callback-url=http:\/\/192.168.0.1:5050\/v1\/continue ipa-inspection-collectors=default .* foo=bar || goto retry_boot/ ) end @@ -297,7 +297,7 @@ describe 'ironic::inspector' do it 'should contain file /var/www/httpboot/inspector.ipxe' do is_expected.to contain_file('/var/www/httpboot/inspector.ipxe').with_content( - /kernel http:\/\/\[fd00::1\]:3816\/agent.kernel ipa-inspection-callback-url=http:\/\/\[fd00::1\]:5050\/v1\/continue ipa-inspection-collectors=default.* foo=bar || goto retry_boot/ + /kernel http:\/\/\[fd00::1\]:3816\/agent.kernel ipa-inspection-callback-url=http:\/\/\[fd00::1\]:5050\/v1\/continue ipa-inspection-collectors=default .* foo=bar || goto retry_boot/ ) end end