Remove lma_collector::collectd::service

This changes removes the lma_collector::collectd::service because it
is incompatible with lma_collector::collectd::python. The
incompatibility is related to both lma_collector::collectd::service
and lma_collector::collectd::python declaring a "collectd" service
resource. It is a mistake to have the lma_collector module declare
the "collectd" service, as the "collectd" module is responsible for
that.

Change-Id: I504753ebdf04fd77ab22be4d5caf94ea67db4397
This commit is contained in:
Éric Lemoine 2016-01-12 16:04:50 +01:00
parent 10ac375e58
commit 43c5824e1d
7 changed files with 23 additions and 63 deletions

View File

@ -23,6 +23,9 @@ if $lma_collector_hash['influxdb_mode'] != 'disabled' {
# overwritten by the next run. Currently only controller nodes have python
# plugins installed so it's safe to install on all other roles .. for now.
if ! ('controller' in $roles or 'primary-controller' in $roles){
class { 'lma_collector::collectd::base':
processes => ['hekad', 'collectd'],
}
class { 'lma_collector::collectd::ceph_osd': }
}else{
notice('ceph_osd_perf not configured to avoid messing of collectd python plugin configuration!')

View File

@ -16,7 +16,6 @@ class lma_collector::collectd::ceph_osd
{
include lma_collector::params
include collectd::params
include lma_collector::collectd::service
$python_module_path = $lma_collector::params::python_module_path
@ -30,7 +29,7 @@ class lma_collector::collectd::ceph_osd
group => $collectd::params::root_group,
mode => '0644',
content => template('lma_collector/collectd_python.conf.erb'),
notify => Class['lma_collector::collectd::service'],
notify => Service['collectd'],
}
lma_collector::collectd::python_script { 'base.py':

View File

@ -28,7 +28,6 @@ class lma_collector::collectd::controller (
) inherits lma_collector::params {
include collectd::params
include lma_collector::collectd::service
$openstack_configuration = {
'Username' => $service_user,
@ -132,7 +131,7 @@ class lma_collector::collectd::controller (
group => $collectd::params::root_group,
mode => '0640',
content => template('lma_collector/collectd_python.conf.erb'),
notify => Class['lma_collector::collectd::service'],
notify => Service['collectd'],
}
lma_collector::collectd::python_script { 'base.py':

View File

@ -18,17 +18,23 @@ define lma_collector::collectd::dbi_mysql_status (
$username = undef,
$password = undef,
$dbname = undef,
){
) {
include collectd::params
include lma_collector::collectd::service
$plugin_conf_dir = $collectd::params::plugin_conf_dir
# FIXME(elemoine) we really should use the collectd::plugin::dbi class
# instead of adding collectd configuration files ourselves. Adding collectd
# configuration files ourselves forces us to reference to "collectd" service
# resource, which is private to the "collectd" module.
file { "${plugin_conf_dir}/dbi_mysql_status.conf":
owner => 'root',
group => $collectd::params::root_group,
mode => '0640',
content => template('lma_collector/collectd_dbi_mysql_status.conf.erb'),
notify => Class['lma_collector::collectd::service'],
notify => Service['collectd'],
}
}

View File

@ -21,8 +21,9 @@ define lma_collector::collectd::dbi_services (
$report_interval = undef,
$downtime_factor = undef,
) {
include collectd::params
include lma_collector::collectd::service
$service = $title
if $report_interval == undef {
@ -49,11 +50,16 @@ define lma_collector::collectd::dbi_services (
$plugin_conf_dir = $collectd::params::plugin_conf_dir
# FIXME(elemoine) we really should use the collectd::plugin::dbi class
# instead of adding collectd configuration files ourselves. Adding collectd
# configuration files ourselves forces us to reference to "collectd" service
# resource, which is private to the "collectd" module.
file { "${plugin_conf_dir}/dbi_${service}_${type}.conf":
owner => 'root',
group => $collectd::params::root_group,
mode => '0640',
content => template('lma_collector/collectd_dbi_services.conf.erb'),
notify => Class['lma_collector::collectd::service'],
notify => Service['collectd'],
}
}

View File

@ -15,7 +15,6 @@
define lma_collector::collectd::python_script {
include collectd::params
include lma_collector::params
include lma_collector::collectd::service
$python_module_path = $lma_collector::params::python_module_path
@ -24,6 +23,6 @@ define lma_collector::collectd::python_script {
group => $collectd::params::root_group,
mode => '0644',
source => "puppet:///modules/lma_collector/collectd/${title}",
notify => Class['lma_collector::collectd::service'],
notify => Service['collectd'],
}
}

View File

@ -1,52 +0,0 @@
# Copyright 2015 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.
#
# Class: lma_collector::collectd::service
#
# Manages the collectd daemon
#
# Sample Usage:
#
# sometype { 'foo':
# notify => Class['lma_collector::collectd::service'],
# }
#
#
class lma_collector::collectd::service (
$service_enable = true,
$service_ensure = 'running',
$service_manage = true,
) {
include collectd::params
validate_bool($service_enable)
validate_bool($service_manage)
case $service_ensure {
true, false, 'running', 'stopped': {
$_service_ensure = $service_ensure
}
default: {
$_service_ensure = undef
}
}
if $service_manage {
service { 'collectd':
ensure => $_service_ensure,
enable => $service_enable,
}
}
}