Explicitly set default notifier strategy

Havana claims to set this to the default, but in reality it does not.
The default is actually set to qpid because oslo.config automatically
looks for default options in /usr/share/glance/glance-api-dist.conf,
which in turn sets `notifier_strategy = qpid`.

Later version of oslo.config seem to have fixed this behavior and do not
load *-dist* config files.

Though this patch exposes a $notifier_strategy parameter to the
glance::api class, including glance::notify::{rabbit,qpid} to set the
correct notifier strategy should still be the prescribed way to override
the 'noop' behavior.

Change-Id: Ic2c67da463e7053a98042d9cba099aa857913ee7
This commit is contained in:
uberj 2014-03-20 15:24:40 -07:00
parent 32b9729b60
commit 4914bacb63
6 changed files with 20 additions and 5 deletions

View File

@ -159,7 +159,8 @@ class glance::api(
$show_image_direct_url = false,
$cert_file = false,
$key_file = false,
$ca_file = false
$ca_file = false,
$notifier_strategy = 'noop',
) inherits glance {
require keystone::python
@ -185,6 +186,10 @@ class glance::api(
require => Class['glance'],
}
@glance_api_config {
'DEFAULT/notifier_strategy': value => $notifier_strategy;
}
if($sql_connection =~ /mysql:\/\/\S+:\S+@\S+\/\S+/) {
require 'mysql::python'
} elsif($sql_connection =~ /postgresql:\/\/\S+:\S+@\S+\/\S+/) {

View File

@ -8,8 +8,11 @@ class glance::notify::qpid(
$qpid_port = '5672',
) inherits glance::api {
Glance_api_config <| title == 'DEFAULT/notifier_strategy' |> {
value => 'qpid'
}
glance_api_config {
'DEFAULT/notifier_strategy': value => 'qpid';
'DEFAULT/qpid_hostname': value => $qpid_hostname;
'DEFAULT/qpid_port': value => $qpid_port;
'DEFAULT/qpid_username': value => $qpid_username;

View File

@ -13,8 +13,11 @@ class glance::notify::rabbitmq(
$rabbit_durable_queues = false
) {
Glance_api_config <| title == 'DEFAULT/notifier_strategy' |> {
value => 'rabbit'
}
glance_api_config {
'DEFAULT/notifier_strategy': value => 'rabbit';
'DEFAULT/rabbit_host': value => $rabbit_host;
'DEFAULT/rabbit_port': value => $rabbit_port;
'DEFAULT/rabbit_virtual_host': value => $rabbit_virtual_host;

View File

@ -32,7 +32,8 @@ describe 'glance::api' do
:keystone_password => 'ChangeMe',
:sql_idle_timeout => '3600',
:sql_connection => 'sqlite:///var/lib/glance/glance.sqlite',
:show_image_direct_url => false
:show_image_direct_url => false,
:notifier_strategy => 'noop'
}
end
@ -88,7 +89,8 @@ describe 'glance::api' do
'bind_port',
'registry_host',
'registry_port',
'show_image_direct_url'
'show_image_direct_url',
'notifier_strategy'
].each do |config|
should contain_glance_api_config("DEFAULT/#{config}").with_value(param_hash[config.intern])
end

View File

@ -14,6 +14,7 @@ describe 'glance::notify::qpid' do
end
it { should contain_glance_api_config('DEFAULT/notifier_strategy').with_value('qpid') }
it { should contain_glance_api_config('DEFAULT/notifier_strategy').without_value('noop') }
it { should contain_glance_api_config('DEFAULT/qpid_username').with_value('guest') }
it { should contain_glance_api_config('DEFAULT/qpid_password').with_value('pass') }
it { should contain_glance_api_config('DEFAULT/qpid_hostname').with_value('localhost') }

View File

@ -15,6 +15,7 @@ describe 'glance::notify::rabbitmq' do
end
it { should contain_glance_api_config('DEFAULT/notifier_strategy').with_value('rabbit') }
it { should contain_glance_api_config('DEFAULT/notifier_strategy').without_value('noop') }
it { should contain_glance_api_config('DEFAULT/rabbit_password').with_value('pass') }
it { should contain_glance_api_config('DEFAULT/rabbit_userid').with_value('guest') }
it { should contain_glance_api_config('DEFAULT/rabbit_host').with_value('localhost') }