diff --git a/manifests/api.pp b/manifests/api.pp index 846bc257..068416d2 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -139,6 +139,12 @@ # Tested versions include 0.9 and 2.2 # Defaults to '0.9'. # +# [*known_stores*] +# (optional)List of which store classes and store class locations are +# currently known to glance at startup. +# Defaults to false. +# Example: ['glance.store.filesystem.Store','glance.store.http.Store'] +# class glance::api( $keystone_password, $verbose = false, @@ -172,6 +178,7 @@ class glance::api( $key_file = false, $ca_file = false, $mysql_module = '0.9', + $known_stores = false, ) inherits glance { require keystone::python @@ -223,6 +230,17 @@ class glance::api( 'DEFAULT/show_image_direct_url': value => $show_image_direct_url; } + # known_stores config + if $known_stores { + glance_api_config { + 'DEFAULT/known_stores': value => join($known_stores, ','); + } + } else { + glance_api_config { + 'DEFAULT/known_stores': ensure => absent; + } + } + glance_cache_config { 'DEFAULT/verbose': value => $verbose; 'DEFAULT/debug': value => $debug; diff --git a/spec/classes/glance_api_spec.rb b/spec/classes/glance_api_spec.rb index 1fb7575a..dbbea3c6 100644 --- a/spec/classes/glance_api_spec.rb +++ b/spec/classes/glance_api_spec.rb @@ -34,7 +34,8 @@ describe 'glance::api' do :sql_connection => 'sqlite:///var/lib/glance/glance.sqlite', :show_image_direct_url => false, :purge_config => false, - :mysql_module => '0.9' + :mysql_module => '0.9', + :known_stores => false, } end @@ -286,4 +287,21 @@ describe 'glance::api' do it { should contain_glance_api_config('DEFAULT/key_file').with_value('/tmp/key_file') } end end + describe 'with known_stores by default' do + let :params do + default_params + end + + it { should_not contain_glance_api_config('DEFAULT/known_stores').with_value('false') } + end + + describe 'with known_stores override' do + let :params do + default_params.merge({ + :known_stores => ['glance.store.filesystem.Store','glance.store.http.Store'], + }) + end + + it { should contain_glance_api_config('DEFAULT/known_stores').with_value("glance.store.filesystem.Store,glance.store.http.Store") } + end end