Skip to content

Commit

Permalink
Merge branch 'feature/workaround-for-puppetdb-14031'
Browse files Browse the repository at this point in the history
  • Loading branch information
bobapple committed Jan 18, 2017
2 parents 73e83b3 + e395475 commit 84a9aeb
Show file tree
Hide file tree
Showing 36 changed files with 421 additions and 499 deletions.
4 changes: 2 additions & 2 deletions manifests/feature/idomysql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
validate_bool($enable_ha)
validate_re($failover_timeout, '^\d+[ms]*$')
if $cleanup { validate_hash($cleanup) }
if $categories { validate_array($categories) }
if $categories { $_categories = any2array($categories) } else { $_categories = undef }
validate_bool($import_schema)
if $ssl_capath { validate_absolute_path($ssl_capath) }
if $ssl_cipher { validate_string($ssl_cipher) }
Expand Down Expand Up @@ -311,7 +311,7 @@
enable_ha => $enable_ha,
failover_timeout => $failover_timeout,
cleanup => $cleanup,
categories => $categories,
categories => $_categories,

}

Expand Down
4 changes: 2 additions & 2 deletions manifests/feature/idopgsql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
validate_bool($enable_ha)
validate_re($failover_timeout, '^\d+[ms]*$')
if $cleanup { validate_hash($cleanup) }
if $categories { validate_array($categories) }
if $categories { $_categories = any2array($categories) } else { $_categories = undef }
validate_bool($import_schema)

package { 'icinga2-ido-pgsql':
Expand Down Expand Up @@ -134,7 +134,7 @@
enable_ha => $enable_ha,
failover_timeout => $failover_timeout,
cleanup => $cleanup,
categories => $categories,
categories => $_categories,
}

# create object
Expand Down
3 changes: 1 addition & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@
validate_bool($enable)
validate_bool($manage_repo)
validate_bool($manage_service)
validate_array($features)
validate_bool($purge_features)
validate_hash($constants)
validate_array($plugins)
Expand Down Expand Up @@ -169,5 +168,5 @@
subscribe => Class['::icinga2::config']
}

include prefix($features, '::icinga2::feature::')
include prefix(any2array($features), '::icinga2::feature::')
}
10 changes: 4 additions & 6 deletions manifests/object.pp
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@
unless is_bool($apply) { validate_re($apply, '^.+\s+(=>\s+.+\s+)?in\s+.+$') }
if $apply_target { validate_re($apply_target, ['^Host$', '^Service$'],
"${apply_target} isn't supported. Valid values are 'Host' and 'Service'.") }
validate_array($import)
validate_array($assign)
validate_array($ignore)
validate_hash($attrs)
validate_string($object_type)
validate_absolute_path($target)
Expand All @@ -103,9 +100,10 @@
fail('The object type must be different from the apply target')
}

$_attrs = merge($attrs, {
'assign where' => $assign,
'ignore where' => $ignore,
$_import = any2array($import)
$_attrs = merge($attrs, {
'assign where' => any2array($assign),
'ignore where' => any2array($ignore),
})

if !defined(Concat[$target]) {
Expand Down
3 changes: 1 addition & 2 deletions manifests/object/apiuser.pp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
validate_string($apiuser_name)
validate_string($order)
validate_absolute_path($target)
validate_array($permissions)

if $password { validate_string($password) }
if $client_cn { validate_string($client_cn) }
Expand All @@ -72,7 +71,7 @@
$attrs = {
password => $password,
client_cn => $client_cn,
permissions => $permissions,
permissions => any2array($permissions),
}

# create object
Expand Down
6 changes: 2 additions & 4 deletions manifests/object/checkcommand.pp
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,18 @@
# validation
validate_re($ensure, [ '^present$', '^absent$' ],
"${ensure} isn't supported. Valid values are 'present' and 'absent'.")
validate_array($import)
validate_absolute_path($target)
validate_integer($order)

if $checkcommand_name { validate_string($checkcommand_name) }
if !is_array($command) { validate_string($command) }
if !is_string($command) { validate_array($command) }
if $command { $_command = any2array($command) } else { $_command = undef }
if $env { validate_hash($env) }
if $timeout { validate_integer($timeout) }
if $arguments { validate_hash($arguments) }

# compose the attributes
$attrs = {
command => $command,
command => $_command,
env => $env,
vars => $vars,
timeout => $timeout,
Expand Down
5 changes: 2 additions & 3 deletions manifests/object/dependency.pp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
unless is_bool($apply) { validate_string($apply) }
validate_re($apply_target, ['^Host$', '^Service$'],
"${apply_target} isn't supported. Valid values are 'Host' and 'Service'.")
validate_array($import)
validate_bool($template)
validate_absolute_path($target)
validate_string($order)
Expand All @@ -115,7 +114,7 @@
if $disable_notifications { validate_bool ( $disable_notifications ) }
if $ignore_soft_states { validate_bool ( $ignore_soft_states ) }
if $period { validate_string ( $period ) }
if $states { validate_array ( $states ) }
if $states { $_states = any2array($states) } else { $_states = undef }

# compose attributes
$attrs = {
Expand All @@ -127,7 +126,7 @@
'disable_notifications' => $disable_notifications,
'ignore_soft_states' => $ignore_soft_states,
'period' => $period,
'states' => $states,
'states' => $_states,
}

# create object
Expand Down
1 change: 0 additions & 1 deletion manifests/object/eventcommand.pp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
validate_string($eventcommand_name)
validate_absolute_path($target)
validate_string($order)
validate_array($import)

if !is_array($command) { validate_string($command) }
if !is_string($command) { validate_array($command) }
Expand Down
6 changes: 3 additions & 3 deletions manifests/object/host.pp
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,16 @@
# validation
validate_re($ensure, [ '^present$', '^absent$' ],
"${ensure} isn't supported. Valid values are 'present' and 'absent'.")
validate_array($import)
validate_bool($template)
validate_absolute_path($target)
validate_integer($order)

if $host_name { validate_string($host_name) }
if $address { validate_string($address) }
if $address6 { validate_string($address6) }
if $groups { validate_array($groups) }
if $display_name { validate_string($display_name) }
if $vars { validate_hash($vars) }
if $groups { $_groups = any2array($groups) } else { $_groups = undef }
validate_string($check_command)
if $max_check_attempts { validate_integer($max_check_attempts) }
if $check_period { validate_string($check_period) }
Expand Down Expand Up @@ -188,7 +188,7 @@
address => $address,
address6 => $address6,
vars => $vars,
groups => $groups,
groups => $_groups,
display_name => $display_name,
check_command => $check_command,
max_check_attempts => $max_check_attempts,
Expand Down
6 changes: 2 additions & 4 deletions manifests/object/hostgroup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,11 @@
validate_re($ensure, [ '^present$', '^absent$' ],
"${ensure} isn't supported. Valid values are 'present' and 'absent'.")
validate_string($hostgroup_name)
validate_array($assign)
validate_array($ignore)
validate_string($order)
validate_absolute_path($target)

if $display_name { validate_string($display_name) }
if $groups { validate_array($groups) }
if $groups { $_groups = any2array($groups) } else { $_groups = undef }

if $ignore != [] and $assign == [] {
fail('When attribute ignore is used, assign must be set.')
Expand All @@ -63,7 +61,7 @@
# compose the attributes
$attrs = {
display_name => $display_name,
groups => $groups,
groups => $_groups,
}

# create object
Expand Down
33 changes: 15 additions & 18 deletions manifests/object/notification.pp
Original file line number Diff line number Diff line change
Expand Up @@ -110,24 +110,21 @@
unless is_bool($apply) { validate_string($apply) }
validate_re($apply_target, ['^Host$', '^Service$'],
"${apply_target} isn't supported. Valid values are 'Host' and 'Service'.")
validate_array($import)
validate_bool($template)
validate_absolute_path($target)
validate_string($order)

validate_string ($host_name)
if $service_name { validate_string ($service_name)}
if $users { validate_array ($users )}
if $user_groups { validate_array ($user_groups )}
if $times { validate_hash ($times )}
if $command { validate_string ($command )}
if $interval { validate_integer ($interval )}
if $period { validate_string ($period )}
if $zone { validate_string ($zone) }
if $types { validate_array ($types) }
if $states { validate_array ($states) }
if $assign { validate_array ($assign) }
if $ignore { validate_array ($ignore) }
validate_string($host_name)
if $service_name { validate_string($service_name) }
if $users { $_users = any2array($users) } else { $_users = undef }
if $user_groups { $_user_groups = any2array($user_groups) } else { $_user_groups = undef }
if $times { validate_hash($times) }
if $command { validate_string($command) }
if $interval { validate_integer($interval) }
if $period { validate_string($period) }
if $zone { validate_string($zone) }
if $types { $_types = any2array($types) } else { $_types = undef }
if $states { $_states = any2array($states) } else { $_states = undef }

if $ignore != [] and $assign == [] {
fail('When attribute ignore is used, assign must be set.')
Expand All @@ -138,15 +135,15 @@
'host_name' => $host_name,
'service_name' => $service_name,
'vars' => $vars,
'users' => $users,
'user_groups' => $user_groups,
'users' => $_users,
'user_groups' => $_user_groups,
'times' => $times,
'command' => $command,
'interval' => $interval,
'period' => $period,
'zone' => $zone,
'types' => $types,
'states' => $states,
'types' => $_types,
'states' => $_states,
}

# create object
Expand Down
6 changes: 2 additions & 4 deletions manifests/object/notificationcommand.pp
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,18 @@
validate_re($ensure, [ '^present$', '^absent$' ],
"${ensure} isn't supported. Valid values are 'present' and 'absent'.")
validate_string($notificationcommand_name)
validate_array($import)
validate_bool($template)
validate_absolute_path($target)
validate_string($order)

if !is_array($command) { validate_string($command) }
if !is_string($command) { validate_array($command) }
if $command { $_command = any2array($command) } else { $_command = undef }
if $env { validate_hash ($env) }
if $timeout { validate_integer ($timeout) }
if $arguments { validate_hash ($arguments) }

# compose attributes
$attrs = {
'command' => $command,
'command' => $_command,
'env' => $env,
'vars' => $vars,
'timeout' => $timeout,
Expand Down
16 changes: 10 additions & 6 deletions manifests/object/scheduleddowntime.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
# Set to present enables the object, absent disables it. Defaults to present.
#
# [*scheduleddowntime_name*]
# Set the Icinga 2 name of the scheduleddowntime object. Defaults to title of the define resource.
# Set the Icinga 2 name of the scheduleddowntime object.
# Defaults to title of the define resource.
#
# [*host_name*]
# The name of the host this comment belongs to.
#
# [*service_name*]
# The short name of the service this comment belongs to. If omitted, this comment object is treated as host comment.
# The short name of the service this comment belongs to. If omitted,
# this comment object is treated as host comment.
#
# [*author*]
# The author's name.
Expand All @@ -29,14 +31,16 @@
# The duration as number.
#
# [*ranges*]
# A dictionary containing information which days and durations apply to this timeperiod.
# A dictionary containing information which days and durations
# apply to this timeperiod.
#
# [*apply*]
# Dispose an apply instead an object if set to 'true'. Value is taken as statement,
# i.e. 'vhost => config in host.vars.vhosts'. Defaults to false.
# Dispose an apply instead an object if set to 'true'. Value is taken as
# statement, i.e. 'vhost => config in host.vars.vhosts'. Defaults to false.
#
# [*apply_target*]
# An object type on which to target the apply rule. Valid values are `Host` and `Service`. Defaults to `Host`.
# An object type on which to target the apply rule. Valid values
# are `Host` and `Service`. Defaults to `Host`.
#
# [*assign*]
# Assign user group members using the group assign rules.
Expand Down
47 changes: 23 additions & 24 deletions manifests/object/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -201,43 +201,42 @@
"${ensure} isn't supported. Valid values are 'present' and 'absent'.")
validate_string($service_name)
unless is_bool($apply) { validate_string($apply) }
validate_array($import)
validate_bool($template)
validate_absolute_path($target)
validate_string($order)

if $display_name { validate_string ($display_name) }
validate_string($host_name)
if $groups { validate_array ($groups) }
validate_string($check_command)
if $max_check_attempts { validate_integer ($max_check_attempts) }
if $check_period { validate_string ($check_period) }
if $display_name { validate_string($display_name) }
if $host_name { validate_string($host_name) }
if $groups { $_groups = any2array($groups) } else { $_groups = undef }
if $check_command { validate_string($check_command) }
if $max_check_attempts { validate_integer($max_check_attempts) }
if $check_period { validate_string($check_period) }
if $check_timeout { validate_re($check_timeout, '^\d+\.?\d*[d|h|m|s]?$') }
if $check_interval { validate_re($check_interval, '^\d+\.?\d*[d|h|m|s]?$') }
if $retry_interval { validate_re($retry_interval, '^\d+\.?\d*[d|h|m|s]?$') }
if $enable_notifications { validate_bool ($enable_notifications) }
if $enable_active_checks { validate_bool ($enable_active_checks) }
if $enable_passive_checks { validate_bool ($enable_passive_checks) }
if $enable_event_handler { validate_bool ($enable_event_handler) }
if $enable_flapping { validate_bool ($enable_flapping) }
if $enable_perfdata { validate_bool ($enable_perfdata) }
if $event_command { validate_string ($event_command) }
if $flapping_threshold { validate_integer ($flapping_threshold) }
if $volatile { validate_bool ($volatile) }
if $zone { validate_string ($zone) }
if $command_endpoint { validate_string ($command_endpoint) }
if $notes { validate_string ($notes) }
if $notes_url { validate_string ($notes_url) }
if $action_url { validate_string ($action_url) }
if $icon_image { validate_absolute_path ($icon_image) }
if $icon_image_alt { validate_string ($icon_image_alt) }
if $enable_notifications { validate_bool($enable_notifications) }
if $enable_active_checks { validate_bool($enable_active_checks) }
if $enable_passive_checks { validate_bool($enable_passive_checks) }
if $enable_event_handler { validate_bool($enable_event_handler) }
if $enable_flapping { validate_bool($enable_flapping) }
if $enable_perfdata { validate_bool($enable_perfdata) }
if $event_command { validate_string($event_command) }
if $flapping_threshold { validate_integer($flapping_threshold) }
if $volatile { validate_bool($volatile) }
if $zone { validate_string($zone) }
if $command_endpoint { validate_string($command_endpoint) }
if $notes { validate_string($notes) }
if $notes_url { validate_string($notes_url) }
if $action_url { validate_string($action_url) }
if $icon_image { validate_absolute_path($icon_image) }
if $icon_image_alt { validate_string($icon_image_alt) }


# compose the attributes
$attrs = {
'display_name' => $display_name ,
'host_name' => $host_name ,
'groups' => $groups ,
'groups' => $_groups ,
'vars' => $vars ,
'check_command' => $check_command ,
'max_check_attempts' => $max_check_attempts ,
Expand Down
Loading

0 comments on commit 84a9aeb

Please sign in to comment.