Add sync_db param to aodh api class

Change-Id: Ibd7e8c2b7812dc45b29f4c422c442c9a3ffdf47d
This commit is contained in:
Pradeep Kilambi 2016-04-07 12:00:12 -04:00
parent 004d25f9a5
commit 4cc0e6498f
3 changed files with 23 additions and 0 deletions

View File

@ -51,6 +51,10 @@
# to make aodh-api be a web app using apache mod_wsgi.
# Defaults to '$::aodh::params::api_service_name'
#
# [*sync_db*]
# (optional) Run gnocchi-upgrade db sync on api nodes after installing the package.
# Defaults to false
class aodh::api (
$manage_service = true,
$enabled = true,
@ -63,6 +67,7 @@ class aodh::api (
$host = '0.0.0.0',
$port = '8042',
$service_name = $::aodh::params::api_service_name,
$sync_db = false,
) inherits aodh::params {
include ::aodh::params
@ -90,6 +95,10 @@ class aodh::api (
}
}
if $sync_db {
include ::aodh::db::sync
}
if $service_name == $::aodh::params::api_service_name {
service { 'aodh-api':
ensure => $service_ensure,

View File

@ -0,0 +1,6 @@
---
fixes:
- Add a sync_db option to ::aodh::api class. This makes it easier
to control the db sync. The sync_db param is a boolean and set to
false by default for backward compatibility so db sync is not run
out of the box.

View File

@ -66,6 +66,14 @@ describe 'aodh::api' do
end
end
context 'with sync_db set to true' do
before do
params.merge!(
:sync_db => true)
end
it { is_expected.to contain_class('aodh::db::sync') }
end
context 'with disabled service managing' do
before do
params.merge!({