diff --git a/manifests/dashboard.pp b/manifests/dashboard.pp index 8668cec..a144981 100644 --- a/manifests/dashboard.pp +++ b/manifests/dashboard.pp @@ -49,18 +49,23 @@ # (Optional) Log handler. # Defaults to 'file' # +# [*image_filter_project_id*] +# (Optional) Filter image list by project ID +# Defaults to 'undef' +# class murano::dashboard( - $package_ensure = 'present', - $dashboard_name = undef, - $repo_url = undef, - $enable_glare = false, - $collect_static_script = '/usr/share/openstack-dashboard/manage.py', - $metadata_dir = '/var/cache/murano-dashboard', - $max_file_size = '5', - $dashboard_debug_level = 'DEBUG', - $client_debug_level = 'ERROR', - $log_handler = 'file', - $sync_db = true, + $package_ensure = 'present', + $dashboard_name = undef, + $repo_url = undef, + $enable_glare = false, + $collect_static_script = '/usr/share/openstack-dashboard/manage.py', + $metadata_dir = '/var/cache/murano-dashboard', + $max_file_size = '5', + $dashboard_debug_level = 'DEBUG', + $client_debug_level = 'ERROR', + $log_handler = 'file', + $sync_db = true, + $image_filter_project_id = undef, ) { include ::murano::deps diff --git a/releasenotes/notes/images-filter-project.yaml-23fcc5ea964e2599.yaml b/releasenotes/notes/images-filter-project.yaml-23fcc5ea964e2599.yaml new file mode 100644 index 0000000..38722db --- /dev/null +++ b/releasenotes/notes/images-filter-project.yaml-23fcc5ea964e2599.yaml @@ -0,0 +1,3 @@ +--- +features: + - Add dashboard parameter for filtering images by a given project ID. diff --git a/spec/classes/murano_dashboard_spec.rb b/spec/classes/murano_dashboard_spec.rb index 9b4dd85..4a0a650 100644 --- a/spec/classes/murano_dashboard_spec.rb +++ b/spec/classes/murano_dashboard_spec.rb @@ -8,14 +8,15 @@ describe 'murano::dashboard' do end let :dashboard_params do { - :dashboard_name => 'Application Catalog', - :repo_url => 'http://storage.apps.openstack.com', - :enable_glare => true, - :collect_static_script => '/bin/openstack-dashboard/manage.py', - :metadata_dir => '/tmp/muranodashboard-cache', - :max_file_size => '5', - :sync_db => false, - :log_handler => 'console', + :dashboard_name => 'Application Catalog', + :repo_url => 'http://storage.apps.openstack.com', + :enable_glare => true, + :collect_static_script => '/bin/openstack-dashboard/manage.py', + :metadata_dir => '/tmp/muranodashboard-cache', + :max_file_size => '5', + :sync_db => false, + :log_handler => 'console', + :image_filter_project_id => '00000000-0000-0000-0000-000000000000', } end @@ -61,6 +62,7 @@ describe 'murano::dashboard' do it { is_expected.to_not contain_concat__fragment('murano_dashboard_section').with_content(/MURANO_API_URL = /)} it { is_expected.to_not contain_concat__fragment('murano_dashboard_section').with_content(/MURANO_REPO_URL = /)} it { is_expected.to_not contain_concat__fragment('murano_dashboard_section').with_content(/MURANO_DASHBOARD_NAME = /)} + it { is_expected.to_not contain_concat__fragment('murano_dashboard_section').with_content(/MURANO_IMAGE_FILTER_PROJECT_ID = /)} it { is_expected.to contain_concat__fragment('murano_dashboard_section').with_content(/MAX_FILE_SIZE_MB = '5'/)} it { is_expected.to contain_concat__fragment('murano_dashboard_section').with_content(/METADATA_CACHE_DIR = '\/var\/cache\/murano-dashboard'/)} it { is_expected.to contain_concat__fragment('murano_dashboard_section').with_content(/LOGGING\['loggers'\]\['muranodashboard'\] = \{'handlers': 'file', 'level': 'DEBUG'\}/)} @@ -119,6 +121,7 @@ describe 'murano::dashboard' do it { is_expected.to contain_concat__fragment('murano_dashboard_section').with_content(/LOGGING\['loggers'\]\['muranodashboard'\] = \{'handlers': 'console', 'level': 'DEBUG'\}/)} it { is_expected.to contain_concat__fragment('murano_dashboard_section').with_content(/LOGGING\['loggers'\]\['muranoclient'\] = \{'handlers': 'console', 'level': 'ERROR'\}/)} it { is_expected.to contain_concat__fragment('murano_dashboard_section').with_content(/MURANO_USE_GLARE = True/)} + it { is_expected.to contain_concat__fragment('murano_dashboard_section').with_content(/MURANO_IMAGE_FILTER_PROJECT_ID = '00000000-0000-0000-0000-000000000000'/)} it { is_expected.to contain_exec('clean_horizon_config').with({ :command => 'sed -e \'/^## MURANO_CONFIG_BEGIN/,/^## MURANO_CONFIG_END ##/ d\' -i /etc/openstack-dashboard/local_settings.py', diff --git a/templates/local_settings.py.erb b/templates/local_settings.py.erb index 529efbe..544bb6d 100644 --- a/templates/local_settings.py.erb +++ b/templates/local_settings.py.erb @@ -10,4 +10,5 @@ MURANO_USE_GLARE = True <% else %> MURANO_USE_GLARE = False <% end %> +<% if @image_filter_project_id != nil %>MURANO_IMAGE_FILTER_PROJECT_ID = '<%= @image_filter_project_id %>'<% end %> ## MURANO_CONFIG_END ##