From fbeaf416ee3064f2dfaf2c9364c020f20a2ac55d Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sat, 20 Apr 2024 23:35:57 +0900 Subject: [PATCH] magnum: Replace keypair_id by keypair_name The keypair_id option in magnum0-tempest-plugin was replaced by the keypair_name option in 0.3.0[1] but the module implementation was not updated accordingly. Closes-Bug: #2062970 Depends-on: https://review.opendev.org/651027 Change-Id: Ia76df84007503d52e57e595abe86f6c53946d325 --- manifests/magnum.pp | 26 ++++++++++++++++--- .../notes/bug-2062970-135b7ad85622eaf5.yaml | 9 +++++++ spec/classes/tempest_magnum_spec.rb | 6 ++--- 3 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 releasenotes/notes/bug-2062970-135b7ad85622eaf5.yaml diff --git a/manifests/magnum.pp b/manifests/magnum.pp index fd8e810d..04ea57e9 100644 --- a/manifests/magnum.pp +++ b/manifests/magnum.pp @@ -41,9 +41,9 @@ # (Optional) If ::tempest::magnum should configure the testing keypair # Defaults to false (not yet supported, will be true when implemented) # -# [*keypair_id*] +# [*keypair_name*] # (Optional) The keypair_id parameter used in Magnum tempest configuration -# Defaults to 'default' +# Defaults to $facts['os_service_default'] # # [*nic_id*] # (Optional) The nic_id parameter used in Magnum tempest configuration @@ -65,6 +65,12 @@ # (Optional) Manage the plugin package # Defaults to true # +# DEPRECATED PARAMETERS +# +# [*keypair_id*] +# (Optional) The keypair_id parameter used in Magnum tempest configuration +# Defaults to undef +# class tempest::magnum ( Stdlib::Absolutepath $tempest_config_file = '/var/lib/tempest/etc/tempest.conf', Boolean $provision_image = true, @@ -75,15 +81,22 @@ class tempest::magnum ( String[1] $flavor_id = 's1.magnum', String[1] $master_flavor_id = 'm1.magnum', Boolean $provision_keypair = false, - $keypair_id = 'default', + $keypair_name = $facts['os_service_default'], $nic_id = 'public', $magnum_url = undef, $copy_logs = true, $dns_nameserver = '8.8.8.8', Boolean $manage_tests_packages = true, + # DEPRECATED PARAMETERS + $keypair_id = undef, ) { include tempest::params + if $keypair_id != undef { + warning("The keypair_id parameter is deprecated and has no effect. \ +Use the keypair_name parameter.") + } + if $provision_image { $image_properties = { 'os_distro' => $image_os_distro } glance_image { $image_name: @@ -131,11 +144,16 @@ class tempest::magnum ( tempest_config { 'magnum/image_id': value => $image_name; 'magnum/nic_id': value => $nic_id; - 'magnum/keypair_id': value => $keypair_id; + 'magnum/keypair_name': value => $keypair_name; 'magnum/flavor_id': value => $flavor_id; 'magnum/master_flavor_id': value => $master_flavor_id; 'magnum/magnum_url': value => $magnum_url; 'magnum/copy_logs': value => $copy_logs; 'magnum/dns_nameserver': value => $dns_nameserver; } + + # TODO(tkajinam): Remove this after 2025.1 + tempest_config { + 'magnum/keypair_id': ensure => absent; + } } diff --git a/releasenotes/notes/bug-2062970-135b7ad85622eaf5.yaml b/releasenotes/notes/bug-2062970-135b7ad85622eaf5.yaml new file mode 100644 index 00000000..c997e479 --- /dev/null +++ b/releasenotes/notes/bug-2062970-135b7ad85622eaf5.yaml @@ -0,0 +1,9 @@ +--- +features: + - | + The new ``tempest::magnum::keypair_name`` parameter has been added. + +deprecations: + - | + The new ``tempest::magnum::keypair_id`` parameter has been deprecated and + has no effect now. diff --git a/spec/classes/tempest_magnum_spec.rb b/spec/classes/tempest_magnum_spec.rb index 66ffe80d..76b866cb 100644 --- a/spec/classes/tempest_magnum_spec.rb +++ b/spec/classes/tempest_magnum_spec.rb @@ -18,7 +18,7 @@ describe 'tempest::magnum' do is_expected.to contain_tempest_config('magnum/image_id').with_value('fedora-atomic-latest') is_expected.to contain_tempest_config('magnum/nic_id').with_value('b2e6021a-4956-4a1f-8329-790b9add05a9') - is_expected.to contain_tempest_config('magnum/keypair_id').with_value('default') + is_expected.to contain_tempest_config('magnum/keypair_name').with_value('') is_expected.to contain_tempest_config('magnum/flavor_id').with_value('s1.magnum') is_expected.to contain_tempest_config('magnum/master_flavor_id').with_value('m1.magnum') is_expected.to contain_tempest_config('magnum/copy_logs').with_value('true') @@ -34,7 +34,7 @@ describe 'tempest::magnum' do :provision_flavors => false, :flavor_id => 's1.tempest', :master_flavor_id => 'm1.tempest', - :keypair_id => 'magnum', + :keypair_name => 'magnum', :provision_keypair => false, :magnum_url => 'http://magnum/', :copy_logs => false, @@ -45,7 +45,7 @@ describe 'tempest::magnum' do it 'configures tempest for magnum' do is_expected.to contain_tempest_config('magnum/image_id').with_value('coreos') is_expected.to contain_tempest_config('magnum/nic_id').with_value('b2e6021a-4956-4a1f-8329-790b9add05a9') - is_expected.to contain_tempest_config('magnum/keypair_id').with_value('magnum') + is_expected.to contain_tempest_config('magnum/keypair_name').with_value('magnum') is_expected.to contain_tempest_config('magnum/flavor_id').with_value('s1.tempest') is_expected.to contain_tempest_config('magnum/master_flavor_id').with_value('m1.tempest') is_expected.to contain_tempest_config('magnum/magnum_url').with_value('http://magnum/')