From 4cc0e6498ff1715916f37977efe0105a5bf6c33a Mon Sep 17 00:00:00 2001 From: Pradeep Kilambi Date: Thu, 7 Apr 2016 12:00:12 -0400 Subject: [PATCH] Add sync_db param to aodh api class Change-Id: Ibd7e8c2b7812dc45b29f4c422c442c9a3ffdf47d --- manifests/api.pp | 9 +++++++++ .../notes/add-sync_db-to-aodh-dc2c52e0dcda72c1.yaml | 6 ++++++ spec/classes/aodh_api_spec.rb | 8 ++++++++ 3 files changed, 23 insertions(+) create mode 100644 releasenotes/notes/add-sync_db-to-aodh-dc2c52e0dcda72c1.yaml diff --git a/manifests/api.pp b/manifests/api.pp index 7d7f5044..22a397ef 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -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, diff --git a/releasenotes/notes/add-sync_db-to-aodh-dc2c52e0dcda72c1.yaml b/releasenotes/notes/add-sync_db-to-aodh-dc2c52e0dcda72c1.yaml new file mode 100644 index 00000000..64d3a9fb --- /dev/null +++ b/releasenotes/notes/add-sync_db-to-aodh-dc2c52e0dcda72c1.yaml @@ -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. diff --git a/spec/classes/aodh_api_spec.rb b/spec/classes/aodh_api_spec.rb index 3567e000..bf3f1599 100644 --- a/spec/classes/aodh_api_spec.rb +++ b/spec/classes/aodh_api_spec.rb @@ -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!({