diff --git a/manifests/api.pp b/manifests/api.pp index 86f67b3..9c40193 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -14,10 +14,28 @@ class openstack_health::api( $server_admin = "webmaster@${::fqdn}", $vhost_name = 'localhost', $vhost_port = 5000, + $ignored_run_metadata_keys = undef, ) { include ::httpd::mod::wsgi + $default_ignored_run_metadata_keys = ['build_change', 'build_node', + 'build_patchset', 'build_ref', + 'build_short_uuid', 'build_uuid', + 'build_zuul_url', 'filename'] + + if $ignored_run_metadata_keys { + # In case it was defined, ensure the value provided is an array + if is_array($ignored_run_metadata_keys) { + $ignored_keys = $ignored_run_metadata_keys + } else { + fail('$ignored_run_metadata_keys parameter should be an array of strings') + } + } else { + # In case it was not defined, use the default value + $ignored_keys = $default_ignored_run_metadata_keys + } + $api_dir = "${source_dir}/openstack_health" $virtualenv_dir = "${source_dir}/.venv" diff --git a/spec/acceptance/api_spec.rb b/spec/acceptance/api_spec.rb index f111799..f893b0f 100644 --- a/spec/acceptance/api_spec.rb +++ b/spec/acceptance/api_spec.rb @@ -43,6 +43,10 @@ describe 'puppet-openstack_health::api manifest', :if => ['debian', 'ubuntu'].in it { should be_file } it { should be_owned_by 'openstack_health' } it { should be_grouped_into 'openstack_health' } + its(:content) { should contain 'db_uri' } + its(:content) { should contain 'ignored_run_metadata_keys' } + its(:content) { should contain 'build_change' } + its(:content) { should contain 'build_zuul_url' } end end diff --git a/templates/openstack-health.conf.erb b/templates/openstack-health.conf.erb index c84d971..5eca1ae 100644 --- a/templates/openstack-health.conf.erb +++ b/templates/openstack-health.conf.erb @@ -1,2 +1,8 @@ [default] db_uri = <%= scope.lookupvar("openstack_health::api::db_uri") %> +<% if @ignored_keys.length > 0 -%> +ignored_run_metadata_keys = + <% @ignored_keys.each do |ignored_key| -%> + <%= ignored_key %> + <% end -%> +<% end -%>