Skip to content

Commit

Permalink
Puppet lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jonhattan committed Oct 16, 2023
1 parent fbadc41 commit 8eeced0
Show file tree
Hide file tree
Showing 25 changed files with 119 additions and 138 deletions.
6 changes: 2 additions & 4 deletions examples/centos7_minimal.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@
# Anything else should be defined with hiera.

node default {

# Provided by stahnma-epel
include ::epel
include epel

include ::monit
include monit
# Set precedence. Cannot do just Class['monit']
# because the way module is constructed.
Class['epel'] -> Class['monit::install']

}
22 changes: 10 additions & 12 deletions manifests/check.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# @param type
# Type of check to perform. See `manifests/check/*.pp` for details.
#
define monit::check(
define monit::check (
Enum[
'directory',
'fifo',
Expand All @@ -36,30 +36,28 @@
'program',
'service',
'system'
] $type,
] $type,
Monit::Check::Ensure $ensure = 'present',
Hash[
String,
Variant[Array, Hash, Integer, String]
] $config = {},
] $config = {},
String $group = $name,
Monit::Check::Tests $tests = [],
String $priority = '20',
String $template = "monit/check/${type}.erb",
String $bundle = $name,
Integer $order = 0,
) {

$defaults = {
'name' => $name,
'ensure' => $ensure,
'group' => $group,
'tests' => $tests,
'priority' => $priority,
'bundle' => $bundle,
'order' => $order,
'name' => $name,
'ensure' => $ensure,
'group' => $group,
'tests' => $tests,
'priority' => $priority,
'bundle' => $bundle,
'order' => $order,
}
$params = merge($config, $defaults)
ensure_resource("monit::check::${type}", "${name}_${type}", $params)
}

5 changes: 2 additions & 3 deletions manifests/check/directory.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
# @param order
# Order of the check within the bundle filename.
#
define monit::check::directory(
define monit::check::directory (
# Check type specific.
Stdlib::Absolutepath $path,
String $template = 'monit/check/directory.erb',

# Common parameters.
Monit::Check::Ensure $ensure = 'present',
String $group = $name,
String $every = '',
Optional[String] $every = undef,
Array[String] $alerts = [],
Array[String] $noalerts = [],
Monit::Check::Tests $tests = [],
Expand All @@ -46,7 +46,6 @@
String $bundle = $name,
Integer $order = 0,
) {

monit::check::instance { "${name}_instance":
ensure => $ensure,
name => $name,
Expand Down
5 changes: 2 additions & 3 deletions manifests/check/fifo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
# @param order
# Order of the check within the bundle filename.
#
define monit::check::fifo(
define monit::check::fifo (
# Check type specific.
Stdlib::Absolutepath $path,
String $template = 'monit/check/fifo.erb',

# Common parameters.
Monit::Check::Ensure $ensure = 'present',
String $group = $name,
String $every = '',
Optional[String] $every = undef,
Array[String] $alerts = [],
Array[String] $noalerts = [],
Monit::Check::Tests $tests = [],
Expand All @@ -46,7 +46,6 @@
String $bundle = $name,
Integer $order = 0,
) {

monit::check::instance { "${name}_instance":
ensure => $ensure,
name => $name,
Expand Down
33 changes: 16 additions & 17 deletions manifests/check/file.pp
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
# @param restart_limit
# Used to define limits on restarts.
#
define monit::check::file(
define monit::check::file (
# Check type specific.
Stdlib::Absolutepath $path,
String $template = 'monit/check/file.erb',

# Common parameters.
Monit::Check::Ensure $ensure = 'present',
String $group = $name,
String $every = '',
Optional[String] $every = undef,
Array[String] $alerts = [],
Array[String] $noalerts = [],
Monit::Check::Tests $tests = [],
Expand All @@ -49,21 +49,20 @@
Integer $order = 0,
Optional[Monit::RestartLimit] $restart_limit = undef,
) {

monit::check::instance { "${name}_instance":
ensure => $ensure,
name => $name,
type => 'file',
header => template($template),
group => $group,
every => $every,
alerts => $alerts,
noalerts => $noalerts,
tests => $tests,
depends => $depends,
priority => $priority,
bundle => $bundle,
order => $order,
restart_limit => $restart_limit,
ensure => $ensure,
name => $name,
type => 'file',
header => template($template),
group => $group,
every => $every,
alerts => $alerts,
noalerts => $noalerts,
tests => $tests,
depends => $depends,
priority => $priority,
bundle => $bundle,
order => $order,
restart_limit => $restart_limit,
}
}
11 changes: 5 additions & 6 deletions manifests/check/filesystem.pp
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,22 @@
# @param order
# Order of the check within the bundle filename.
#
define monit::check::filesystem(
define monit::check::filesystem (
# Check type specific.
String $template = 'monit/check/filesystem.erb',
Optional[Variant[
Stdlib::Absolutepath,
Pattern['^/']
Stdlib::Absolutepath,
Pattern['^/']
]] $path = undef,
Variant[
Array[Stdlib::Absolutepath],
Array[Pattern['^/']]
] $paths = [],
] $paths = [],

# Common parameters.
Monit::Check::Ensure $ensure = 'present',
String $group = $name,
String $every = '',
Optional[String] $every = undef,
Array[String] $alerts = [],
Array[String] $noalerts = [],
Monit::Check::Tests $tests = [],
Expand All @@ -56,7 +56,6 @@
String $bundle = $name,
Integer $order = 0,
) {

if !empty($path) {
warning('\$path parameter is deprecated and will be removed in future versions! Please use \$paths instead')
$_paths = $paths + $path
Expand Down
5 changes: 2 additions & 3 deletions manifests/check/host.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
# @param order
# Order of the check within the bundle filename.
#
define monit::check::host(
define monit::check::host (
# Check type specific.
String $address,
String $template = 'monit/check/host.erb',

# Common parameters.
Monit::Check::Ensure $ensure = 'present',
String $group = $name,
String $every = '',
Optional[String] $every = undef,
Array[String] $alerts = [],
Array[String] $noalerts = [],
Monit::Check::Tests $tests = [],
Expand All @@ -46,7 +46,6 @@
String $bundle = $name,
Integer $order = 0,
) {

#@todo@ match regex for hostname and ip address
#Could leverage thrnio/puppet-ip
# Any solution is overkill as of today.
Expand Down
4 changes: 2 additions & 2 deletions manifests/check/instance.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
# @param restart_limit
# Used to define limits on restarts.
#
define monit::check::instance(
define monit::check::instance (
Monit::Check::Ensure $ensure,
String $type,
String $header,
Expand All @@ -59,7 +59,7 @@
/(false|'false')/ => 'absent',
default => $ensure,
}
concat{ $file:
concat { $file:
ensure => $concat_ensure,
warn => true,
ensure_newline => true,
Expand Down
5 changes: 2 additions & 3 deletions manifests/check/network.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
# @param order
# Order of the check within the bundle filename.
#
define monit::check::network(
define monit::check::network (
# Check type specific.
String $interface,
String $template = 'monit/check/network.erb',

# Common parameters.
Monit::Check::Ensure $ensure = 'present',
String $group = $name,
String $every = '',
Optional[String] $every = undef,
Array[String] $alerts = [],
Array[String] $noalerts = [],
Monit::Check::Tests $tests = [],
Expand All @@ -46,7 +46,6 @@
String $bundle = $name,
Integer $order = 0,
) {

monit::check::instance { "${name}_instance":
ensure => $ensure,
name => $name,
Expand Down
33 changes: 16 additions & 17 deletions manifests/check/process.pp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
# @param order
# Order of the check within the bundle filename.
#
define monit::check::process(
define monit::check::process (
# Check type specific.
Optional[String] $program_start = undef,
Optional[String] $program_stop = undef,
Expand All @@ -63,7 +63,7 @@
# Common parameters.
Monit::Check::Ensure $ensure = 'present',
String $group = $name,
String $every = '',
Optional[String] $every = undef,
Array[String] $alerts = [],
Array[String] $noalerts = [],
Monit::Check::Tests $tests = [],
Expand All @@ -73,7 +73,6 @@
Integer $order = 0,
Optional[Hash] $restart_limit = undef,
) {

if $pidfile {
if $matching {
warning("monit::check::process: both 'pidfile' and 'matching' provided. Ignoring 'matching'.")
Expand All @@ -89,19 +88,19 @@
}

monit::check::instance { "${name}_instance":
ensure => $ensure,
name => $name,
type => 'process',
header => template($template),
group => $group,
every => $every,
alerts => $alerts,
noalerts => $noalerts,
tests => $tests,
depends => $depends,
priority => $priority,
bundle => $bundle,
order => $order,
restart_limit => $restart_limit,
ensure => $ensure,
name => $name,
type => 'process',
header => template($template),
group => $group,
every => $every,
alerts => $alerts,
noalerts => $noalerts,
tests => $tests,
depends => $depends,
priority => $priority,
bundle => $bundle,
order => $order,
restart_limit => $restart_limit,
}
}
5 changes: 2 additions & 3 deletions manifests/check/program.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
# @param order
# Order of the check within the bundle filename.
#
define monit::check::program(
define monit::check::program (
# Check type specific.
Stdlib::Absolutepath $path,
String $template = 'monit/check/program.erb',

# Common parameters.
Monit::Check::Ensure $ensure = 'present',
String $group = $name,
String $every = '',
Optional[String] $every = undef,
Array[String] $alerts = [],
Array[String] $noalerts = [],
Monit::Check::Tests $tests = [],
Expand All @@ -46,7 +46,6 @@
String $bundle = $name,
Integer $order = 0,
) {

monit::check::instance { "${name}_instance":
ensure => $ensure,
name => $name,
Expand Down
7 changes: 3 additions & 4 deletions manifests/check/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@
# @param order
# Order of the check within the bundle filename.
#
define monit::check::service(
define monit::check::service (
# Check type specific.
Undef $template = undef,
Stdlib::Absolutepath $binary = "/usr/sbin/${name}",
Enum[
'sysv',
'systemd',
'upstart'
] $init_system = $monit::init_system,
] $init_system = $monit::init_system,
Stdlib::Absolutepath $sysv_file = "/etc/init.d/${name}",
Stdlib::Absolutepath $upstart_file = "/etc/init/${name}.conf",
Stdlib::Absolutepath $systemd_file = "${monit::params::systemd_unitdir}/${name}.service",
Expand All @@ -85,7 +85,7 @@
# Common parameters.
Monit::Check::Ensure $ensure = 'present',
String $group = $name,
String $every = '',
Optional[String] $every = undef,
Array[String] $alerts = [],
Array[String] $noalerts = [],
Monit::Check::Tests $tests = [],
Expand All @@ -95,7 +95,6 @@
Integer $order = 0,
Optional[Monit::RestartLimit] $restart_limit = undef,
) {

case $init_system {
'sysv': {
$service_file = $sysv_file
Expand Down
Loading

0 comments on commit 8eeced0

Please sign in to comment.