Browse Source

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
changes/01/507901/2
Alex Schultz 5 years ago
parent
commit
70816f417a
  1. 10
      manifests/log.pp
  2. 4
      metadata.json
  3. 11
      releasenotes/notes/ensure-log-debug-is-boolean-ca20c1b14f5774e7.yaml
  4. 9
      spec/defines/oslo_log_spec.rb

10
manifests/log.pp

@ -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 },

4
metadata.json

@ -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",
@ -58,4 +58,4 @@
"source": "git://github.com/openstack/puppet-oslo.git",
"summary": "Puppet module for OpenStack Oslo",
"version": "12.0.0-dev"
}
}

11
releasenotes/notes/ensure-log-debug-is-boolean-ca20c1b14f5774e7.yaml

@ -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

9
spec/defines/oslo_log_spec.rb

@ -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({

Loading…
Cancel
Save