diff --git a/manifests/init.pp b/manifests/init.pp index b6f61250..c96556e7 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -177,10 +177,8 @@ # Defaults to true # [*auth_version*] # Defaults to 'v3' -# [*img_dir*] -# Defaults to '/var/lib/tempest' # [*img_file*] -# Defaults to 'cirros-0.4.0-x86_64-disk.img' +# Defaults to '/var/lib/tempest/cirros-0.4.0-x86_64-disk.img' # [*login_url*] # Defaults to undef # [*dashboard_url*] @@ -226,6 +224,8 @@ # is integrated in neutron tempest plugin. # [*congress_available*] # Defaults to undef +# [*img_dir*] +# Defaults to undef # class tempest( $package_ensure = 'present', @@ -351,8 +351,8 @@ class tempest( $disable_ssl_validation = undef, $manage_tests_packages = false, # scenario options - $img_dir = '/var/lib/tempest', - $img_file = 'cirros-0.4.0-x86_64-disk.img', + # TODO(tkajinam) Update the default value when we remove img_dir parameter + $img_file = undef, # designate options $designate_nameservers = undef, # ironic options @@ -367,6 +367,7 @@ class tempest( $allow_tenant_isolation = undef, $neutron_fwaas_available = undef, $congress_available = undef, + $img_dir = undef, ) { if !is_service_default($tempest_roles) and !empty($tempest_roles){ @@ -412,6 +413,21 @@ class tempest( warning('The tempest::neutron_fwaas_available parameter is deprecated. FWaaS plugin is now part of neutron plugin.') } + if $img_dir != undef { + warning('The tempest::img_dir parameter is deperecated. Set full path in img_file parameter instead') + if $img_file == undef { + $img_file_real = "${img_dir}/cirros-0.4.0-x86_64-disk.img" + } else { + $img_file_real = "${img_dir}/${img_file}" + } + } else { + if $img_file == undef { + $img_file_real = '/var/lib/tempest/cirros-0.4.0-x86_64-disk.img' + } else { + $img_file_real = $img_file + } + } + include tempest::params include openstacklib::openstackclient @@ -579,8 +595,7 @@ class tempest( 'service_available/octavia': value => $octavia_available; 'whitebox/db_uri': value => $whitebox_db_uri; 'cli/cli_dir': value => $cli_dir; - 'scenario/img_dir': value => $img_dir; - 'scenario/img_file': value => $img_file; + 'scenario/img_file': value => $img_file_real; 'service_broker/run_service_broker_tests': value => $run_service_broker_tests; 'dns/nameservers': value => $designate_nameservers; 'compute-feature-enabled/attach_encrypted_volume': value => $attach_encrypted_volume; diff --git a/releasenotes/notes/deprecate-img-dir-b35d0c67bc8f43d3.yaml b/releasenotes/notes/deprecate-img-dir-b35d0c67bc8f43d3.yaml new file mode 100644 index 00000000..57e2b014 --- /dev/null +++ b/releasenotes/notes/deprecate-img-dir-b35d0c67bc8f43d3.yaml @@ -0,0 +1,6 @@ +--- +deprecations: + - | + The img_dir parameter is deprecated and will be removed in a future release. + The img_file parameter must be set with a full path to the image that should + be used. diff --git a/spec/classes/tempest_init_spec.rb b/spec/classes/tempest_init_spec.rb index 04fa8707..607e007c 100644 --- a/spec/classes/tempest_init_spec.rb +++ b/spec/classes/tempest_init_spec.rb @@ -269,8 +269,7 @@ describe 'tempest' do is_expected.to contain_tempest_config('whitebox/db_uri').with(:value => nil) is_expected.to contain_tempest_config('cli/cli_dir').with(:value => nil) is_expected.to contain_tempest_config('oslo_concurrency/lock_path').with(:value => '/var/lib/tempest') - is_expected.to contain_tempest_config('scenario/img_dir').with(:value => '/var/lib/tempest') - is_expected.to contain_tempest_config('scenario/img_file').with(:value => 'cirros-0.4.0-x86_64-disk.img') + is_expected.to contain_tempest_config('scenario/img_file').with(:value => '/var/lib/tempest/cirros-0.4.0-x86_64-disk.img') is_expected.to contain_tempest_config('service_broker/run_service_broker_tests').with(:value => false) is_expected.to contain_oslo__log('tempest_config').with( :debug => false, @@ -315,6 +314,43 @@ describe 'tempest' do end end + context 'with deprecated img_dir parameter and img_file set' do + let :params do + { :image_name => 'cirros', + :image_name_alt => 'cirros' , + :img_file => '/home/stack/myimage.img' } + end + + it 'sets image_file based on img_dir and img_file' do + is_expected.to contain_tempest_config('scenario/img_file').with(:value => '/home/stack/myimage.img') + end + end + + context 'with deprecated img_dir parameter set' do + let :params do + { :image_name => 'cirros', + :image_name_alt => 'cirros', + :img_dir => '/home/stack' } + end + + it 'sets image_file based on img_dir' do + is_expected.to contain_tempest_config('scenario/img_file').with(:value => '/home/stack/cirros-0.4.0-x86_64-disk.img') + end + end + + context 'with deprecated img_dir parameter and img_file set' do + let :params do + { :image_name => 'cirros', + :image_name_alt => 'cirros', + :img_dir => '/home/stack', + :img_file => 'myimage.img' } + end + + it 'sets image_file based on img_dir and img_file' do + is_expected.to contain_tempest_config('scenario/img_file').with(:value => '/home/stack/myimage.img') + end + end + context 'install Tempest from package' do let :params do {:install_from_source => false,