magnum: Drop outdated default value of image_source

The current default value no longer exists. Drop the outdated default
and require a valid value because of no stable URL to obtain the latest
Fedora Core OS image available.

Change-Id: I39688f7bcf12ec93a201632899a46ed47774eb6a
This commit is contained in:
Takashi Kajinami
2024-12-10 11:51:35 +09:00
parent 862123cd98
commit 22ddf9ff29
2 changed files with 35 additions and 23 deletions

View File

@@ -11,8 +11,9 @@
# Defaults to true # Defaults to true
# #
# [*image_source*] # [*image_source*]
# (Optional) If provision_image is true, the location of the image # (Optional) If provision_image is true, the location of the image. Required
# Defaults to 'https://fedorapeople.org/groups/magnum/fedora-atomic-latest.qcow2' # when provision_image is true
# Defaults to undef
# #
# [*image_os_distro*] # [*image_os_distro*]
# (Optional) If provision_image is true, the os_distro propery of the image # (Optional) If provision_image is true, the os_distro propery of the image
@@ -76,24 +77,24 @@
# Defaults to undef # Defaults to undef
# #
class tempest::magnum ( class tempest::magnum (
Boolean $provision_image = true, Boolean $provision_image = true,
String[1] $image_source = 'https://fedorapeople.org/groups/magnum/fedora-atomic-latest.qcow2', Optional[String[1]] $image_source = undef,
String[1] $image_name = 'fedora-atomic-latest', String[1] $image_name = 'fedora-atomic-latest',
String[1] $image_os_distro = 'fedora-atomic', String[1] $image_os_distro = 'fedora-atomic',
Boolean $provision_flavors = true, Boolean $provision_flavors = true,
String[1] $flavor_id = 's1.magnum', String[1] $flavor_id = 's1.magnum',
String[1] $master_flavor_id = 'm1.magnum', String[1] $master_flavor_id = 'm1.magnum',
Boolean $provision_keypair = false, Boolean $provision_keypair = false,
$keypair_name = $facts['os_service_default'], $keypair_name = $facts['os_service_default'],
$nic_id = $facts['os_service_default'], $nic_id = $facts['os_service_default'],
$magnum_url = $facts['os_service_default'], $magnum_url = $facts['os_service_default'],
$copy_logs = $facts['os_service_default'], $copy_logs = $facts['os_service_default'],
$dns_nameserver = $facts['os_service_default'], $dns_nameserver = $facts['os_service_default'],
$catalog_type = $facts['os_service_default'], $catalog_type = $facts['os_service_default'],
Boolean $manage_tests_packages = true, Boolean $manage_tests_packages = true,
# DEPRECATED PARAMETERS # DEPRECATED PARAMETERS
$keypair_id = undef, $keypair_id = undef,
$tempest_config_file = undef, $tempest_config_file = undef,
) { ) {
include tempest::params include tempest::params
include tempest include tempest
@@ -108,6 +109,10 @@ Use the keypair_name parameter.")
} }
if $provision_image { if $provision_image {
if $image_source == undef {
fail('The image_source parameter must be set when provision_image is true')
}
$image_properties = { 'os_distro' => $image_os_distro } $image_properties = { 'os_distro' => $image_os_distro }
glance_image { $image_name: glance_image { $image_name:
ensure => present, ensure => present,

View File

@@ -10,16 +10,19 @@ describe 'tempest::magnum' do
end end
let :params do let :params do
{ :nic_id => 'b2e6021a-4956-4a1f-8329-790b9add05a9', } {
:image_source => 'https://fedorapeople.org/groups/magnum/fedora-atomic-latest.qcow2',
:nic_id => 'b2e6021a-4956-4a1f-8329-790b9add05a9',
}
end end
shared_examples 'tempest magnum' do shared_examples 'tempest magnum' do
context 'with default parameters' do context 'with default parameters' do
it 'provisions resources and configures tempest for magnum' do it 'provisions resources and configures tempest for magnum' do
is_expected.to contain_glance_image('fedora-atomic-latest').with( is_expected.to contain_glance_image('fedora-atomic-latest').with(
:ensure => 'present', :ensure => 'present',
:source => 'https://fedorapeople.org/groups/magnum/fedora-atomic-latest.qcow2', :source => 'https://fedorapeople.org/groups/magnum/fedora-atomic-latest.qcow2',
:properties => '{"os_distro"=>"fedora-atomic"}' :properties => {'os_distro' => 'fedora-atomic'}
) )
is_expected.to contain_nova_flavor('s1.magnum').with_ensure('present') is_expected.to contain_nova_flavor('s1.magnum').with_ensure('present')
is_expected.to contain_nova_flavor('m1.magnum').with_ensure('present') is_expected.to contain_nova_flavor('m1.magnum').with_ensure('present')
@@ -53,6 +56,10 @@ describe 'tempest::magnum' do
}) })
end end
it 'should not provision the image' do
is_expected.to_not contain_glance_image('coreos')
end
it 'configures tempest for 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/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/nic_id').with_value('b2e6021a-4956-4a1f-8329-790b9add05a9')