Revert "Prevent MySQL conn error at collectd init"

This reverts commit 4bc01646ee.

Closes-Bug: #1541818

Change-Id: Iba6aec0992cd4c154d959896a45071544a420923
This commit is contained in:
Eric Lemoine 2016-02-05 07:21:22 +00:00 committed by Éric Lemoine
parent 2b1f014d2e
commit 578015d2e0
4 changed files with 9 additions and 62 deletions

View File

@ -15,7 +15,6 @@
prepare_network_config(hiera('network_scheme', {}))
$messaging_address = get_network_role_property('mgmt/messaging', 'ipaddr')
$memcache_address = get_network_role_property('mgmt/memcache', 'ipaddr')
$database_address = get_network_role_property('mgmt/database', 'ipaddr')
include lma_collector::params
@ -301,12 +300,8 @@ if $lma_collector['influxdb_mode'] != 'disabled' {
cpu_allocation_ratio => 8.0,
}
# We use the "nova" database user to connect to MySQL, but any valid
# user/password could be used really. MySQL listens on
# <management ip>:3307.
class { 'lma_collector::collectd::mysql':
host => $database_address,
port => 3307,
database => 'nova',
username => 'nova',
password => $nova['db_password'],
}

View File

@ -13,27 +13,13 @@
# under the License.
#
class lma_collector::collectd::mysql (
$host = $lma_collector::params::mysql_host,
$port = $lma_collector::params::mysql_port,
$username,
$password,
$database = $lma_collector::params::mysql_database,
$username = $lma_collector::params::mysql_username,
$password = $lma_collector::params::mysql_password,
) inherits lma_collector::params {
validate_string($username)
validate_string($password)
# Previously the collectd::plugin::mysql::database resource title was "nova",
# which did not make sense as the monitoring of MySQL is not at all related
# to Nova. So we use a different resource title and make sure that the file
# associated with the "nova" resource is absent.
collectd::plugin::mysql::database { 'nova':
ensure => absent,
}
collectd::plugin::mysql::database { 'openstack-config':
host => $host,
port => $port,
collectd::plugin::mysql::database { $database:
host => 'localhost',
username => $username,
password => $password,
}

View File

@ -106,8 +106,9 @@ class lma_collector::params {
}
}
$additional_packages = [ 'python-dateutil' ]
$mysql_host = '127.0.0.1'
$mysql_port = 3306
$mysql_database = ''
$mysql_username = ''
$mysql_password = ''
$openstack_user = ''
$openstack_password = ''
$openstack_tenant = ''

View File

@ -1,35 +0,0 @@
# Copyright 2016 Mirantis, 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.
require 'spec_helper'
describe 'lma_collector::collectd::mysql' do
let(:facts) do
{:kernel => 'Linux', :operatingsystem => 'Ubuntu',
:osfamily => 'Debian', :concat_basedir => '/foo'}
end
describe 'with params' do
let(:params) do
{:host => 'example.com', :port => 3307,
:username => 'user', :password => 'password'}
end
it { is_expected.to contain_collectd__plugin__mysql__database('nova') \
.with_ensure('absent') }
it { is_expected.to contain_collectd__plugin__mysql__database('openstack-config') \
.with_host('example.com') \
.with_port(3307) \
.with_username('user') \
.with_password('password') }
end
end