diff options
author | Pradeep Kilambi <pkilambi@redhat.com> | 2017-04-18 19:14:16 -0400 |
---|---|---|
committer | Pradeep Kilambi <pkilambi@redhat.com> | 2017-04-21 14:50:46 +0000 |
commit | 2e89f8ede8369d0a7445599d18ac562ca91e9ad0 (patch) | |
tree | c56def984ef5feea73912b29ba027b93c7cf8669 | |
parent | 2abcfb46d27d3509081839d6a7e2d3bd3255b32e (diff) |
Move ceilometer upgrade re-run out of collector
Since collector is deprecated, lets move this out of collector.pp
so it gets run and resource types are created appropriately even
when collector is not included.
Closes-bug: #1676961
Change-Id: I32445a891c34f519ab16dcecc81993f8909f6481
5 files changed, 49 insertions, 35 deletions
diff --git a/manifests/profile/base/ceilometer.pp b/manifests/profile/base/ceilometer.pp index 2855bd2..e6a2f11 100644 --- a/manifests/profile/base/ceilometer.pp +++ b/manifests/profile/base/ceilometer.pp @@ -18,6 +18,10 @@ # # === Parameters # +# [*bootstrap_node*] +# (Optional) The hostname of the node responsible for bootstrapping tasks +# Defaults to hiera('bootstrap_nodeid') +# # [*step*] # (Optional) The current step in deployment. See tripleo-heat-templates # for more details. @@ -68,6 +72,7 @@ # Defaults to hiera('ceilometer::rabbit_use_ssl', '0') class tripleo::profile::base::ceilometer ( + $bootstrap_node = hiera('bootstrap_nodeid', undef), $step = hiera('step'), $oslomsg_rpc_proto = hiera('messaging_rpc_service_name', 'rabbit'), $oslomsg_rpc_hosts = any2array(hiera('rabbitmq_node_names', undef)), @@ -81,6 +86,11 @@ class tripleo::profile::base::ceilometer ( $oslomsg_notify_username = hiera('ceilometer::rabbit_userid', 'guest'), $oslomsg_use_ssl = hiera('ceilometer::rabbit_use_ssl', '0'), ) { + if $::hostname == downcase($bootstrap_node) { + $sync_db = true + } else { + $sync_db = false + } if $step >= 3 { $oslomsg_use_ssl_real = sprintf('%s', bool2num(str2bool($oslomsg_use_ssl))) @@ -105,4 +115,12 @@ class tripleo::profile::base::ceilometer ( include ::ceilometer::config } + # Run ceilometer-upgrade in step 5 so gnocchi resource types + # are created safely. + if $step >= 5 and $sync_db { + exec {'ceilometer-db-upgrade': + command => 'ceilometer-upgrade --skip-metering-database', + path => ['/usr/bin', '/usr/sbin'], + } + } } diff --git a/manifests/profile/base/ceilometer/collector.pp b/manifests/profile/base/ceilometer/collector.pp index 6b58286..a2c1e29 100644 --- a/manifests/profile/base/ceilometer/collector.pp +++ b/manifests/profile/base/ceilometer/collector.pp @@ -84,13 +84,4 @@ class tripleo::profile::base::ceilometer::collector ( include ::ceilometer::collector include ::ceilometer::dispatcher::gnocchi } - - # Re-run ceilometer-upgrade again in step 5 so gnocchi resource types - # are created safely. - if $step >= 5 and $sync_db { - exec {'ceilometer-db-upgrade': - command => 'ceilometer-upgrade --skip-metering-database', - path => ['/usr/bin', '/usr/sbin'], - } - } } diff --git a/releasenotes/notes/move-ceilo-upgrade-out-3318df875de5cd00.yaml b/releasenotes/notes/move-ceilo-upgrade-out-3318df875de5cd00.yaml new file mode 100644 index 0000000..1899db9 --- /dev/null +++ b/releasenotes/notes/move-ceilo-upgrade-out-3318df875de5cd00.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - Since collector is deprecated, move the ceilo upgrade in step5 + out of collector profile and into cielometer base. This way + ceilo upgrade can run even when collector is disabled which is + the default in pike. diff --git a/spec/classes/tripleo_profile_base_ceilometer_collector_spec.rb b/spec/classes/tripleo_profile_base_ceilometer_collector_spec.rb index 0f9aad7..23b198a 100644 --- a/spec/classes/tripleo_profile_base_ceilometer_collector_spec.rb +++ b/spec/classes/tripleo_profile_base_ceilometer_collector_spec.rb @@ -128,32 +128,6 @@ describe 'tripleo::profile::base::ceilometer::collector' do is_expected.to contain_class('ceilometer::dispatcher::gnocchi') end end - - context 'with step 5 on bootstrap node' do - let(:params) { { - :step => 5, - :bootstrap_node => 'node.example.com', - :mongodb_node_ips => ['127.0.0.1',], - :mongodb_replset => 'replicaset' - } } - - it 'should trigger complete configuration' do - is_expected.to contain_exec('ceilometer-db-upgrade') - end - end - - context 'with step 5 not on bootstrap node' do - let(:params) { { - :step => 5, - :bootstrap_node => 'somethingelse.example.com', - :mongodb_node_ips => ['127.0.0.1',], - :mongodb_replset => 'replicaset' - } } - - it 'should trigger complete configuration' do - is_expected.to_not contain_exec('ceilometer-db-upgrade') - end - end end diff --git a/spec/classes/tripleo_profile_base_ceilometer_spec.rb b/spec/classes/tripleo_profile_base_ceilometer_spec.rb index 9173203..8c1d507 100644 --- a/spec/classes/tripleo_profile_base_ceilometer_spec.rb +++ b/spec/classes/tripleo_profile_base_ceilometer_spec.rb @@ -42,6 +42,31 @@ describe 'tripleo::profile::base::ceilometer' do is_expected.to contain_class('ceilometer::config') end end + + context 'with step 5 with bootstrap node' do + let(:params) { { + :bootstrap_node => 'node.example.com', + :step => 5, + :oslomsg_rpc_hosts => [ '127.0.0.1' ], + :oslomsg_rpc_username => 'ceilometer', + :oslomsg_rpc_password => 'foo', + } } + + it 'should trigger complete configuration' do + is_expected.to contain_exec('ceilometer-db-upgrade') + end + end + + context 'with step 5 without bootstrap node' do + let(:params) { { + :bootstrap_node => 'somethingelse.example.com', + :step => 5, + } } + + it 'should trigger complete configuration' do + is_expected.to_not contain_exec('ceilometer-db-upgrade') + end + end end |