Avoid empty notification driver

Avoid addition of empty notification driver
string in the nova.conf by default.

Change-Id: Ic14b5a4de03562fe7e361d609e152c0b7f01f46c
This commit is contained in:
Michael Polenchuk
2015-09-04 13:21:45 +03:00
parent 0d14fc1208
commit 65f40acac3
2 changed files with 9 additions and 6 deletions

View File

@@ -238,7 +238,7 @@
# [*notification_driver*]
# (optional) Driver or drivers to handle sending notifications.
# Value can be a string or a list.
# Defaults to []
# Defaults to undef
#
# [*notification_topics*]
# (optional) AMQP topic used for OpenStack notifications
@@ -319,7 +319,7 @@ class nova(
$use_stderr = true,
$log_facility = 'LOG_USER',
$install_utilities = true,
$notification_driver = [],
$notification_driver = undef,
$notification_topics = 'notifications',
$notify_api_faults = false,
$notify_on_state_change = undef,
@@ -605,9 +605,12 @@ class nova(
nova_config { 'DEFAULT/log_dir': ensure => absent;}
}
$notification_driver_real = is_string($notification_driver) ? {
true => $notification_driver,
default => join($notification_driver, ',')
if $notification_driver {
nova_config {
'DEFAULT/notification_driver': value => join(any2array($notification_driver), ',');
}
} else {
nova_config { 'DEFAULT/notification_driver': ensure => absent; }
}
nova_config {
@@ -615,7 +618,6 @@ class nova(
'DEFAULT/debug': value => $debug;
'DEFAULT/use_stderr': value => $use_stderr;
'DEFAULT/rpc_backend': value => $rpc_backend;
'DEFAULT/notification_driver': value => $notification_driver_real;
'DEFAULT/notification_topics': value => $notification_topics;
'DEFAULT/notify_api_faults': value => $notify_api_faults;
# Following may need to be broken out to different nova services

View File

@@ -75,6 +75,7 @@ describe 'nova' do
is_expected.to contain_nova_config('DEFAULT/state_path').with_value('/var/lib/nova')
is_expected.to contain_nova_config('DEFAULT/lock_path').with_value(platform_params[:lock_path])
is_expected.to contain_nova_config('DEFAULT/service_down_time').with_value('60')
is_expected.to contain_nova_config('DEFAULT/notification_driver').with_ensure('absent')
is_expected.to contain_nova_config('DEFAULT/rootwrap_config').with_value('/etc/nova/rootwrap.conf')
is_expected.to contain_nova_config('DEFAULT/report_interval').with_value('10')
is_expected.to contain_nova_config('DEFAULT/os_region_name').with_ensure('absent')