diff options
-rw-r--r-- | manifests/profile/base/gnocchi/api.pp | 24 | ||||
-rw-r--r-- | spec/classes/tripleo_profile_base_gnocchi_api_spec.rb | 22 |
2 files changed, 14 insertions, 32 deletions
diff --git a/manifests/profile/base/gnocchi/api.pp b/manifests/profile/base/gnocchi/api.pp index a4e9a30..910375f 100644 --- a/manifests/profile/base/gnocchi/api.pp +++ b/manifests/profile/base/gnocchi/api.pp @@ -89,12 +89,11 @@ class tripleo::profile::base::gnocchi::api ( $tls_keyfile = undef } - if $step >= 3 and $sync_db { + if $step >= 4 and $sync_db { include ::gnocchi::db::sync } - if $step >= 3 { - include ::gnocchi::api + if $step >= 4 or ($step >= 3 and $sync_db) { include ::apache::mod::ssl class { '::gnocchi::wsgi::apache': ssl_cert => $tls_certfile, @@ -107,19 +106,20 @@ class tripleo::profile::base::gnocchi::api ( coordination_url => join(['redis://:', $gnocchi_redis_password, '@', normalize_ip_for_uri($redis_vip), ':6379/']), } case $gnocchi_backend { - 'swift': { include ::gnocchi::storage::swift } + 'swift': { + include ::gnocchi::storage::swift + if $sync_db { + include ::swift::deps + # Ensure we have swift proxy available before running gnocchi-upgrade + # as storage is initialized at this point. + Anchor<| title == 'swift::service::end' |> ~> Class['Gnocchi::db::sync'] + } + } 'file': { include ::gnocchi::storage::file } 'rbd': { include ::gnocchi::storage::ceph } default: { fail('Unrecognized gnocchi_backend parameter.') } } + include ::gnocchi::api } - # Re-run gnochci upgrade with storage as swift/ceph should be up at this - # stage. - if $step >= 5 and $sync_db { - exec {'run gnocchi upgrade with storage': - command => 'gnocchi-upgrade --config-file=/etc/gnocchi/gnocchi.conf', - path => ['/usr/bin', '/usr/sbin'], - } - } } diff --git a/spec/classes/tripleo_profile_base_gnocchi_api_spec.rb b/spec/classes/tripleo_profile_base_gnocchi_api_spec.rb index 6c04e9d..90bdea0 100644 --- a/spec/classes/tripleo_profile_base_gnocchi_api_spec.rb +++ b/spec/classes/tripleo_profile_base_gnocchi_api_spec.rb @@ -36,9 +36,9 @@ describe 'tripleo::profile::base::gnocchi::api' do } end - context 'with step 3 on bootstrap' do + context 'with step 4 on bootstrap' do let(:params) { { - :step => 3, + :step => 4, :bootstrap_node => 'node.example.com', :gnocchi_redis_password => 'gnocchi', :redis_vip => '127.0.0.1' @@ -51,20 +51,6 @@ describe 'tripleo::profile::base::gnocchi::api' do } end - context 'with step 3' do - let(:params) { { - :step => 3, - :gnocchi_redis_password => 'gnocchi', - :redis_vip => '127.0.0.1' - } } - - it { - is_expected.to_not contain_class('gnocchi::db::sync') - is_expected.to contain_class('gnocchi::api') - is_expected.to contain_class('gnocchi::wsgi::apache') - } - end - context 'with step 4' do let(:params) { { :step => 4, @@ -129,10 +115,6 @@ describe 'tripleo::profile::base::gnocchi::api' do it { is_expected.to contain_class('gnocchi::api') is_expected.to contain_class('gnocchi::wsgi::apache') - is_expected.to contain_exec('run gnocchi upgrade with storage').with( - :command => 'gnocchi-upgrade --config-file=/etc/gnocchi/gnocchi.conf', - :path => ['/usr/bin', '/usr/sbin'] - ) } end end |