Ensure debug is a boolean

Use any2bool when the debug value for logging is not the class defaults
to ensure that we pass a true boolean to the configuration file.

Change-Id: Ica3cbb2ca6b1168a49448ace1a38c96d95cdcd88
Closes-Bug: #1719929
This commit is contained in:
Alex Schultz 2017-09-27 09:40:11 -06:00
parent 15301917ce
commit 70816f417a
4 changed files with 31 additions and 3 deletions

View File

@ -131,8 +131,16 @@ define oslo::log(
$default_log_levels_real = join(sort(join_keys_to_values($default_log_levels, '=')), ',')
}
# NOTE(mwhahaha): oslo.log doesn't like it when debug is not a proper python
# boolean. See LP#1719929
if !is_service_default($debug) {
$debug_real = any2bool($debug)
} else {
$debug_real = $debug
}
$log_options = {
'DEFAULT/debug' => { value => $debug },
'DEFAULT/debug' => { value => $debug_real },
'DEFAULT/log_config_append' => { value => $log_config_append },
'DEFAULT/log_date_format' => { value => $log_date_format },
'DEFAULT/log_file' => { value => $log_file },

View File

@ -7,7 +7,7 @@
},
{
"name": "puppetlabs/stdlib",
"version_requirement": ">=4.12.0 <5.0.0"
"version_requirement": ">=4.13.0 <5.0.0"
},
{
"name": "openstack/openstacklib",

View File

@ -0,0 +1,11 @@
---
upgrade:
- |
Bump minimum version of puppetlabs-stdlib to 4.13.0 as we are using the
any2bool function.
fixes:
- |
oslo.log fails if the debug setting is the configuration file is not a
boolean. So we've added boolean conversion to the setting to ensure that
we are either passing a proper boolean or $::os_service_default. We are
leveraging puppetlabs-stdlib any2bool for the conversion. LP#1719929

View File

@ -84,6 +84,15 @@ describe 'oslo::log' do
is_expected.to contain_keystone_config('DEFAULT/fatal_deprecations').with_value(true)
end
end
context 'with debug as an empty string' do
let :params do
{ :debug => '' }
end
it {
is_expected.to contain_keystone_config('DEFAULT/debug').with_value(false)
}
end
end
on_supported_os({