Fix syntax for setting enabled_import_methods

Glance's enabled_import_methods is a ListOpt, and requires explicit
brackets around the list of values. It throws an error if the brackets
are missing.

Related-Bug: #1765439
Change-Id: I6d1b839bdd391a515bc630b32da2fbfcf007f01f
This commit is contained in:
Alan Bishop 2018-05-14 16:22:29 -04:00
parent a4325bd80f
commit 71447a4993
2 changed files with 14 additions and 2 deletions

View File

@ -397,6 +397,13 @@ class glance::api(
)
}
if $enabled_import_methods != $::os_service_default {
# This option is a ListOpt that requires explicit brackets.
$enabled_import_methods_real = sprintf('[%s]', join(any2array($enabled_import_methods), ','))
} else {
$enabled_import_methods_real = $enabled_import_methods
}
# basic service config
glance_api_config {
'DEFAULT/bind_host': value => $bind_host;
@ -409,7 +416,7 @@ class glance::api(
'DEFAULT/scrub_time': value => $scrub_time;
'DEFAULT/delayed_delete': value => $delayed_delete;
'DEFAULT/image_cache_dir': value => $image_cache_dir;
'DEFAULT/enabled_import_methods': value => $enabled_import_methods;
'DEFAULT/enabled_import_methods': value => $enabled_import_methods_real;
'DEFAULT/node_staging_uri': value => $node_staging_uri;
'DEFAULT/image_member_quota': value => $image_member_quota;
'DEFAULT/enable_v1_api': value => $enable_v1_api;

View File

@ -132,7 +132,6 @@ describe 'glance::api' do
'delayed_delete',
'scrub_time',
'image_cache_dir',
'enabled_import_methods',
'node_staging_uri',
'image_member_quota',
'enable_v1_api',
@ -144,6 +143,12 @@ describe 'glance::api' do
end
end
it 'is_expected.to lay down default enabled_import_methods config' do
# Verify brackets "[]" are added to satisfy the ListOpt syntax.
is_expected.to contain_glance_api_config("DEFAULT/enabled_import_methods").with_value(
"[%s]" % param_hash[:enabled_import_methods])
end
it 'is_expected.to lay down default cache config' do
[
'registry_host',