Merge "Move ceilometer upgrade step out of base"

This commit is contained in:
Jenkins 2017-05-26 17:04:46 +00:00 committed by Gerrit Code Review
commit 09b9b70c5d
5 changed files with 54 additions and 44 deletions

View File

@ -18,10 +18,6 @@
# #
# === Parameters # === Parameters
# #
# [*bootstrap_node*]
# (Optional) The hostname of the node responsible for bootstrapping tasks
# Defaults to hiera('bootstrap_nodeid')
#
# [*step*] # [*step*]
# (Optional) The current step in deployment. See tripleo-heat-templates # (Optional) The current step in deployment. See tripleo-heat-templates
# for more details. # for more details.
@ -72,7 +68,6 @@
# Defaults to hiera('ceilometer::rabbit_use_ssl', '0') # Defaults to hiera('ceilometer::rabbit_use_ssl', '0')
class tripleo::profile::base::ceilometer ( class tripleo::profile::base::ceilometer (
$bootstrap_node = hiera('bootstrap_nodeid', undef),
$step = hiera('step'), $step = hiera('step'),
$oslomsg_rpc_proto = hiera('messaging_rpc_service_name', 'rabbit'), $oslomsg_rpc_proto = hiera('messaging_rpc_service_name', 'rabbit'),
$oslomsg_rpc_hosts = any2array(hiera('rabbitmq_node_names', undef)), $oslomsg_rpc_hosts = any2array(hiera('rabbitmq_node_names', undef)),
@ -86,11 +81,6 @@ class tripleo::profile::base::ceilometer (
$oslomsg_notify_username = hiera('ceilometer::rabbit_userid', 'guest'), $oslomsg_notify_username = hiera('ceilometer::rabbit_userid', 'guest'),
$oslomsg_use_ssl = hiera('ceilometer::rabbit_use_ssl', '0'), $oslomsg_use_ssl = hiera('ceilometer::rabbit_use_ssl', '0'),
) { ) {
if $::hostname == downcase($bootstrap_node) {
$sync_db = true
} else {
$sync_db = false
}
if $step >= 3 { if $step >= 3 {
$oslomsg_use_ssl_real = sprintf('%s', bool2num(str2bool($oslomsg_use_ssl))) $oslomsg_use_ssl_real = sprintf('%s', bool2num(str2bool($oslomsg_use_ssl)))
@ -114,13 +104,4 @@ class tripleo::profile::base::ceilometer (
} }
include ::ceilometer::config 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'],
}
}
} }

View File

@ -27,6 +27,7 @@ class tripleo::profile::base::ceilometer::agent::notification (
$step = hiera('step'), $step = hiera('step'),
) { ) {
include ::tripleo::profile::base::ceilometer include ::tripleo::profile::base::ceilometer
include ::tripleo::profile::base::ceilometer::upgrade
if $step >= 4 { if $step >= 4 {
include ::ceilometer::agent::auth include ::ceilometer::agent::auth

View File

@ -51,6 +51,10 @@ class tripleo::profile::base::ceilometer::agent::polling (
) { ) {
include ::tripleo::profile::base::ceilometer include ::tripleo::profile::base::ceilometer
if $central_namespace {
include ::tripleo::profile::base::ceilometer::upgrade
}
if $step >= 4 { if $step >= 4 {
include ::ceilometer::agent::auth include ::ceilometer::agent::auth
class { '::ceilometer::agent::polling': class { '::ceilometer::agent::polling':
@ -60,5 +64,4 @@ class tripleo::profile::base::ceilometer::agent::polling (
coordination_url => join(['redis://:', $ceilometer_redis_password, '@', normalize_ip_for_uri($redis_vip), ':6379/']), coordination_url => join(['redis://:', $ceilometer_redis_password, '@', normalize_ip_for_uri($redis_vip), ':6379/']),
} }
} }
} }

View File

@ -0,0 +1,49 @@
# Copyright 2016 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# == Class: tripleo::profile::base::ceilometer::upgrade
#
# Ceilometer upgrade profile for tripleo
#
# === 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.
# Defaults to hiera('step')
#
class tripleo::profile::base::ceilometer::upgrade (
$bootstrap_node = hiera('bootstrap_nodeid', undef),
$step = hiera('step'),
) {
if $::hostname == downcase($bootstrap_node) {
$sync_db = true
} else {
$sync_db = false
}
# 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'],
}
}
}

View File

@ -43,30 +43,6 @@ describe 'tripleo::profile::base::ceilometer' do
end end
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 end