Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace validate_* with datatypes #706

Merged
merged 69 commits into from
Nov 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
6d9ea13
replace validate_* with datatypes in install
bastelfreak Nov 1, 2017
4536a4b
replace validate_* with datatypes in exec
bastelfreak Nov 1, 2017
8e1ad75
replace validate_* with datatypes in netlink
bastelfreak Nov 1, 2017
de95db9
replace validate_* with datatypes in config
bastelfreak Nov 1, 2017
f08bab5
replace validate_* with datatypes in amqp
bastelfreak Nov 1, 2017
8cfb9cd
replace validate_* with datatypes in query
bastelfreak Nov 1, 2017
ca48ca4
replace validate_* with datatypes in database
bastelfreak Nov 1, 2017
20bc846
replace validate_* with datatypes in apache
bastelfreak Nov 1, 2017
19943fe
replace validate_* with datatypes in memory
bastelfreak Nov 1, 2017
f6e0557
replace validate_* with datatypes in bind
bastelfreak Nov 1, 2017
f35cb8f
replace validate_* with datatypes in perl::plugin
bastelfreak Nov 1, 2017
175e5b0
replace validate_* with datatypes in collectd
bastelfreak Nov 1, 2017
37b6eeb
replace validate_* with datatypes in cgroups
bastelfreak Nov 1, 2017
88020be
replace validate_* with datatypes in memcached
bastelfreak Nov 1, 2017
5d9f9b3
replace validate_* with datatypes in python
bastelfreak Nov 1, 2017
f06dd09
replace validate_* with datatypes in cpu
bastelfreak Nov 1, 2017
8730228
replace validate_* with datatypes in mysql::database
bastelfreak Nov 1, 2017
f67b065
replace validate_* with datatypes in curl_json
bastelfreak Nov 1, 2017
36c442a
replace validate_* with datatypes in irq
bastelfreak Nov 1, 2017
d6fe483
replace validate_* with datatypes in smart
bastelfreak Nov 1, 2017
b815646
replace validate_* with datatypes in df
bastelfreak Nov 1, 2017
68c5675
replace validate_* with datatypes in disk
bastelfreak Nov 1, 2017
53bf4fe
replace validate_* with datatypes in postgresql::query
bastelfreak Nov 1, 2017
53f54c1
replace validate_* with datatypes in postgresql::writer
bastelfreak Nov 1, 2017
2b0f62f
replace validate_* with datatypes in dns
bastelfreak Nov 1, 2017
3ee7422
replace validate_* with datatypes in ethtstat
bastelfreak Nov 1, 2017
29e126f
replace validate_* with datatypes in python::module
bastelfreak Nov 1, 2017
c891abd
replace validate_* with datatypes in exec::cmd
bastelfreak Nov 1, 2017
9f9b4d5
replace validate_* with datatypes in protocols
bastelfreak Nov 1, 2017
ef6af0a
replace validate_* with datatypes in fhcount
bastelfreak Nov 1, 2017
e90fa75
replace validate_* with datatypes in rrdtool
bastelfreak Nov 1, 2017
0cb3946
replace validate_* with datatypes in filecount
bastelfreak Nov 1, 2017
96e6d66
replace validate_* with datatypes in rabbitmq
bastelfreak Nov 1, 2017
194db6d
replace validate_* with datatypes in filecount::directory
bastelfreak Nov 1, 2017
e46244f
replace validate_* with datatypes in unixsock
bastelfreak Nov 1, 2017
c77c9e8
replace validate_* with datatypes in write_riemann
bastelfreak Nov 1, 2017
d36ab9f
replace validate_* with datatypes in genericjmx:mbean
bastelfreak Nov 1, 2017
f7b5123
replace validate_* with datatypes in hddtemp
bastelfreak Nov 1, 2017
2923d86
replace validate_* with datatypes in tail:file
bastelfreak Nov 1, 2017
b9cf24e
replace validate_* with datatypes in repo
bastelfreak Nov 1, 2017
efb97e4
replace validate_* with datatypes in write_tsdb
bastelfreak Nov 1, 2017
0d914a6
replace validate_* with datatypes in write_sensu
bastelfreak Nov 1, 2017
27f7590
replace validate_* with datatypes in write_prometheus
bastelfreak Nov 1, 2017
8ece9b2
replace validate_* with datatypes in interface
bastelfreak Nov 1, 2017
eeb2799
replace validate_* with datatypes in ping
bastelfreak Nov 1, 2017
06efa17
replace validate_* with datatypes in write_graphite::carbon
bastelfreak Nov 1, 2017
5b5fc6d
replace validate_* with datatypes in ipmi_conf
bastelfreak Nov 1, 2017
ae2daaf
replace validate_* with datatypes in write_http
bastelfreak Nov 1, 2017
2ceb6d4
replace validate_* with datatypes in iptables
bastelfreak Nov 1, 2017
191ee99
replace validate_* with datatypes in java
bastelfreak Nov 1, 2017
e849553
replace validate_* with datatypes in mongodb
bastelfreak Nov 1, 2017
b3f8c46
replace validate_* with datatypes in network
bastelfreak Nov 1, 2017
9140d76
drop validate_* with datatypes in network::listener
bastelfreak Nov 1, 2017
2928d92
drop validate_* with datatypes in network::server
bastelfreak Nov 1, 2017
4499b31
replace validate_* with datatypes in openldap
bastelfreak Nov 1, 2017
257eb25
replace validate_* with datatypes in openvpn
bastelfreak Nov 1, 2017
d4a46dd
replace validate_* with datatypes in rrdcached
bastelfreak Nov 1, 2017
33e60ba
replace validate_* with datatypes in processes
bastelfreak Nov 1, 2017
f3d925a
replace validate_* with datatypes in statsd
bastelfreak Nov 1, 2017
22272b5
replace validate_* with datatypes in swap
bastelfreak Nov 1, 2017
1e65097
replace validate_* with datatypes in tcpconns
bastelfreak Nov 1, 2017
81a11e2
replace validate_* with datatypes in tail
bastelfreak Nov 1, 2017
aea2d88
replace validate_* with datatypes in thermal
bastelfreak Nov 1, 2017
6a9c8b4
replace validate_* with datatypes in write_graphite
bastelfreak Nov 1, 2017
118cdc3
replace validate_* with datatypes in varnish
bastelfreak Nov 1, 2017
109b026
replace validate_* with datatypes in virt
bastelfreak Nov 1, 2017
62e3602
replace validate_* with datatypes in kafka
bastelfreak Nov 1, 2017
a708baa
replace validate_* with datatypes in write_log
bastelfreak Nov 1, 2017
eda89c0
replace validate_* with datatypes in write_network
bastelfreak Nov 1, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 20 additions & 33 deletions manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,40 +1,27 @@
# private
class collectd::config (
$collectd_hostname = $collectd::collectd_hostname,
$config_file = $collectd::config_file,
$conf_content = $collectd::conf_content,
$fqdnlookup = $collectd::fqdnlookup,
$has_wordexp = $collectd::has_wordexp,
$include = $collectd::include,
$internal_stats = $collectd::internal_stats,
$interval = $collectd::interval,
$plugin_conf_dir = $collectd::plugin_conf_dir,
$plugin_conf_dir_mode = $collectd::plugin_conf_dir_mode,
$recurse = $collectd::recurse,
$root_group = $collectd::root_group,
$purge = $collectd::purge,
$purge_config = $collectd::purge_config,
$read_threads = $collectd::read_threads,
$timeout = $collectd::timeout,
$typesdb = $collectd::typesdb,
$write_queue_limit_high = $collectd::write_queue_limit_high,
$write_queue_limit_low = $collectd::write_queue_limit_low,
$write_threads = $collectd::write_threads,
$collectd_hostname = $collectd::collectd_hostname,
Stdlib::Absolutepath $config_file = $collectd::config_file,
$conf_content = $collectd::conf_content,
Boolean $fqdnlookup = $collectd::fqdnlookup,
Boolean $has_wordexp = $collectd::has_wordexp,
Array $include = $collectd::include,
Boolean $internal_stats = $collectd::internal_stats,
Integer $interval = $collectd::interval,
Stdlib::Absolutepath $plugin_conf_dir = $collectd::plugin_conf_dir,
$plugin_conf_dir_mode = $collectd::plugin_conf_dir_mode,
$recurse = $collectd::recurse,
$root_group = $collectd::root_group,
$purge = $collectd::purge,
Boolean $purge_config = $collectd::purge_config,
Integer $read_threads = $collectd::read_threads,
Integer $timeout = $collectd::timeout,
Array $typesdb = $collectd::typesdb,
$write_queue_limit_high = $collectd::write_queue_limit_high,
$write_queue_limit_low = $collectd::write_queue_limit_low,
Integer $write_threads = $collectd::write_threads,
) {

validate_absolute_path($config_file)
validate_bool($fqdnlookup)
validate_bool($has_wordexp)
validate_array($include)
validate_bool($internal_stats)
validate_integer($interval)
validate_absolute_path($plugin_conf_dir)
validate_bool($purge_config)
validate_integer($read_threads)
validate_integer($timeout)
validate_array($typesdb)
validate_integer($write_threads)

$_conf_content = $purge_config ? {
true => template('collectd/collectd.conf.erb'),
default => $conf_content,
Expand Down
64 changes: 32 additions & 32 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
#
class collectd (
$collectd_hostname = $collectd::params::collectd_hostname,
$conf_content = $collectd::params::conf_content,
$config_file = $collectd::params::config_file,
$fqdnlookup = $collectd::params::fqdnlookup,
$has_wordexp = $collectd::params::has_wordexp,
$include = $collectd::params::include,
$interval = $collectd::params::interval,
$internal_stats = $collectd::params::internal_stats,
$manage_package = $collectd::params::manage_package,
$manage_repo = $collectd::params::manage_repo,
$ci_package_repo = $collectd::params::ci_package_repo,
$manage_service = $collectd::params::manage_service,
$minimum_version = $collectd::params::minimum_version,
$package_ensure = $collectd::params::package_ensure,
$package_install_options = $collectd::params::package_install_options,
$package_name = $collectd::params::package_name,
$package_provider = $collectd::params::package_provider,
$plugin_conf_dir = $collectd::params::plugin_conf_dir,
$plugin_conf_dir_mode = $collectd::params::plugin_conf_dir_mode,
$purge = $collectd::params::purge,
$purge_config = $collectd::params::purge_config,
$read_threads = $collectd::params::read_threads,
$recurse = $collectd::params::recurse,
$root_group = $collectd::params::root_group,
$service_enable = $collectd::params::service_enable,
$service_ensure = $collectd::params::service_ensure,
$service_name = $collectd::params::service_name,
$timeout = $collectd::params::timeout,
$typesdb = $collectd::params::typesdb,
$write_queue_limit_high = $collectd::params::write_queue_limit_high,
$write_queue_limit_low = $collectd::params::write_queue_limit_low,
$write_threads = $collectd::params::write_threads,
$collectd_hostname = $collectd::params::collectd_hostname,
$conf_content = $collectd::params::conf_content,
$config_file = $collectd::params::config_file,
$fqdnlookup = $collectd::params::fqdnlookup,
$has_wordexp = $collectd::params::has_wordexp,
$include = $collectd::params::include,
$interval = $collectd::params::interval,
$internal_stats = $collectd::params::internal_stats,
$manage_package = $collectd::params::manage_package,
$manage_repo = $collectd::params::manage_repo,
Optional[Pattern[/(^5.4|^5.5|^5.6|^5.7|^master)/]] $ci_package_repo = $collectd::params::ci_package_repo,
$manage_service = $collectd::params::manage_service,
$minimum_version = $collectd::params::minimum_version,
$package_ensure = $collectd::params::package_ensure,
$package_install_options = $collectd::params::package_install_options,
$package_name = $collectd::params::package_name,
$package_provider = $collectd::params::package_provider,
$plugin_conf_dir = $collectd::params::plugin_conf_dir,
$plugin_conf_dir_mode = $collectd::params::plugin_conf_dir_mode,
$purge = $collectd::params::purge,
$purge_config = $collectd::params::purge_config,
$read_threads = $collectd::params::read_threads,
$recurse = $collectd::params::recurse,
$root_group = $collectd::params::root_group,
$service_enable = $collectd::params::service_enable,
$service_ensure = $collectd::params::service_ensure,
$service_name = $collectd::params::service_name,
$timeout = $collectd::params::timeout,
$typesdb = $collectd::params::typesdb,
$write_queue_limit_high = $collectd::params::write_queue_limit_high,
$write_queue_limit_low = $collectd::params::write_queue_limit_low,
$write_threads = $collectd::params::write_threads,
) inherits collectd::params {

$collectd_version_real = pick($::collectd_version, $minimum_version)
Expand Down
13 changes: 5 additions & 8 deletions manifests/install.pp
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
class collectd::install (
$package_ensure = $collectd::package_ensure,
$package_name = $collectd::package_name,
$package_provider = $collectd::package_provider,
$package_install_options = $collectd::package_install_options,
$manage_package = $collectd::manage_package,
$package_ensure = $collectd::package_ensure,
$package_name = $collectd::package_name,
$package_provider = $collectd::package_provider,
Optional[Array] $package_install_options = $collectd::package_install_options,
$manage_package = $collectd::manage_package,
) {
if $package_install_options != undef {
validate_array($package_install_options)
}

if $manage_package {
package { $package_name:
Expand Down
36 changes: 17 additions & 19 deletions manifests/plugin/amqp.pp
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
# https://collectd.org/wiki/index.php/Plugin:AMQP
class collectd::plugin::amqp (
$ensure = 'present',
$manage_package = undef,
$amqphost = 'localhost',
$amqpport = 5672,
$amqpvhost = 'graphite',
$amqpuser = 'graphite',
$amqppass = 'graphite',
$amqpformat = 'Graphite',
$amqpstorerates = false,
$amqpexchange = 'metrics',
$amqppersistent = true,
$amqproutingkey = 'collectd',
$graphiteprefix = 'collectd.',
$escapecharacter = '_',
$interval = undef,
$graphiteseparateinstances = false,
$graphitealwaysappendds = false,
$ensure = 'present',
$manage_package = undef,
$amqphost = 'localhost',
$amqpport = 5672,
$amqpvhost = 'graphite',
$amqpuser = 'graphite',
$amqppass = 'graphite',
$amqpformat = 'Graphite',
$amqpstorerates = false,
$amqpexchange = 'metrics',
Boolean $amqppersistent = true,
$amqproutingkey = 'collectd',
$graphiteprefix = 'collectd.',
$escapecharacter = '_',
$interval = undef,
Boolean $graphiteseparateinstances = false,
Boolean $graphitealwaysappendds = false,
) {

include ::collectd

$_manage_package = pick($manage_package, $::collectd::manage_package)

validate_bool($amqppersistent, $graphiteseparateinstances, $graphitealwaysappendds)

if $::osfamily == 'RedHat' {
if $_manage_package {
package { 'collectd-amqp':
Expand Down
16 changes: 5 additions & 11 deletions manifests/plugin/apache.pp
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
# https://collectd.org/wiki/index.php/Plugin:Apache
class collectd::plugin::apache (
$ensure = 'present',
$manage_package = undef,
$instances = { 'localhost' => { 'url' => 'http://localhost/mod_status?auto' } },
$interval = undef,
$package_install_options = $collectd::package_install_options,
$ensure = 'present',
$manage_package = undef,
Hash $instances = { 'localhost' => { 'url' => 'http://localhost/mod_status?auto' } },
$interval = undef,
Optional[Array] $package_install_options = $collectd::package_install_options,
) {

include ::collectd

$_manage_package = pick($manage_package, $::collectd::manage_package)

validate_hash($instances)

if $package_install_options != undef {
validate_array($package_install_options)
}

if $::osfamily == 'RedHat' {
if $_manage_package {
package { 'collectd-apache':
Expand Down
33 changes: 11 additions & 22 deletions manifests/plugin/bind.pp
Original file line number Diff line number Diff line change
@@ -1,34 +1,23 @@
# https://collectd.org/wiki/index.php/Plugin:BIND
class collectd::plugin::bind (
$url,
$ensure = 'present',
$manage_package = undef,
$memorystats = true,
$opcodes = true,
$parsetime = false,
$qtypes = true,
$resolverstats = false,
$serverstats = true,
$zonemaintstats = true,
$views = [],
$interval = undef,
$ensure = 'present',
$manage_package = undef,
Boolean $memorystats = true,
Boolean $opcodes = true,
Boolean $parsetime = false,
Boolean $qtypes = true,
Boolean $resolverstats = false,
Boolean $serverstats = true,
Boolean $zonemaintstats = true,
Array $views = [],
$interval = undef,
) {

include ::collectd

$_manage_package = pick($manage_package, $::collectd::manage_package)

validate_bool(
$memorystats,
$opcodes,
$parsetime,
$qtypes,
$resolverstats,
$serverstats,
$zonemaintstats,
)
validate_array($views)

if $::osfamily == 'RedHat' {
if $_manage_package {
package { 'collectd-bind':
Expand Down
12 changes: 5 additions & 7 deletions manifests/plugin/ceph.pp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#== Class: collectd::plugin::ceph
#
# Class to manage ceph plugin for collectd
# Class to manage ceph plugin for collectd
# === Parameters
# [*ensure*]
# ensure param for collectd::plugin type
#
#
# [*daemons*]
# array of ceph daemons to create config for (replace clustername, hostname as appropriate)
# example: [ '[clustername]-osd.1', '[clustername]-osd.2', '[clustername]-osd.3', '[clustername]-mon.[hostname].asok' ]
#
#
#
# [*longrunavglatency*] If enabled, latency values(sum,count pairs) are
# calculated as the long run average - average since the ceph daemon was
Expand All @@ -32,9 +32,9 @@
# [*package_name*]
# to be used with manage_package; if manage_package is true, this gives the name
# of the package to manage. Defaults to 'collectd-ceph'
#
#
class collectd::plugin::ceph (
$daemons,
Array $daemons,
$ensure = 'present',
$longrunavglatency = false,
$convertspecialmetrictypes = true,
Expand All @@ -44,8 +44,6 @@

include ::collectd

validate_array($daemons)

if $manage_package {
package { 'collectd-ceph':
ensure => $ensure,
Expand Down
11 changes: 4 additions & 7 deletions manifests/plugin/cgroups.pp
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
# https://collectd.org/wiki/index.php/Plugin:cgroups
class collectd::plugin::cgroups (
$cgroups = undef,
$ensure = 'present',
$ignore_selected = false,
$interval = undef,
Optional[Array] $cgroups = undef,
$ensure = 'present',
Boolean $ignore_selected = false,
$interval = undef,
) {

include ::collectd

$cgroups_real = pick($cgroups, [])

validate_array($cgroups_real)
validate_bool($ignore_selected)

collectd::plugin { 'cgroups':
ensure => $ensure,
content => template('collectd/plugin/cgroups.conf.erb'),
Expand Down
15 changes: 4 additions & 11 deletions manifests/plugin/cpu.pp
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
# https://collectd.org/wiki/index.php/Plugin:CPU
class collectd::plugin::cpu (
$ensure = 'present',
$reportbystate = true,
$reportbycpu = true,
$valuespercentage = false,
$reportnumcpu = false,
Boolean $reportbystate = true,
Boolean $reportbycpu = true,
Boolean $valuespercentage = false,
Boolean $reportnumcpu = false,
$interval = undef,
) {

include ::collectd

validate_bool(
$reportbystate,
$reportbycpu,
$valuespercentage,
$reportnumcpu,
)

collectd::plugin { 'cpu':
ensure => $ensure,
content => template('collectd/plugin/cpu.conf.erb'),
Expand Down
4 changes: 1 addition & 3 deletions manifests/plugin/curl_json.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
define collectd::plugin::curl_json (
$url,
$instance,
$keys,
Hash $keys,
$ensure = 'present',
$host = undef,
$interval = undef,
Expand All @@ -21,8 +21,6 @@

include ::collectd

validate_hash($keys)

$_manage_package = pick($manage_package, $::collectd::manage_package)

if $_manage_package {
Expand Down
Loading