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

Revert "Merge branch 'feature/workaround-for-puppetdb-14031'" #215

Merged
merged 3 commits into from
Jan 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ This module has been tested on:

Other operating systems or versions may work but have not been tested.

It's recommended to enable the future parser when using this module in combination with exported resources.

## Usage

### Installing Icinga 2
Expand Down
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 { $_categories = any2array($categories) } else { $_categories = undef }
if $categories { validate_array($categories) }
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 { $_categories = any2array($categories) } else { $_categories = undef }
if $categories { validate_array($categories) }
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: 2 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
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 @@ -168,5 +169,5 @@
subscribe => Class['::icinga2::config']
}

include prefix(any2array($features), '::icinga2::feature::')
include prefix($features, '::icinga2::feature::')
}
10 changes: 6 additions & 4 deletions manifests/object.pp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@
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 @@ -100,10 +103,9 @@
fail('The object type must be different from the apply target')
}

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

if !defined(Concat[$target]) {
Expand Down
3 changes: 2 additions & 1 deletion manifests/object/apiuser.pp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
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 @@ -71,7 +72,7 @@
$attrs = {
password => $password,
client_cn => $client_cn,
permissions => any2array($permissions),
permissions => $permissions,
}

# create object
Expand Down
6 changes: 4 additions & 2 deletions manifests/object/checkcommand.pp
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,20 @@
# 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 $command { $_command = any2array($command) } else { $_command = undef }
if !is_array($command) { validate_string($command) }
if !is_string($command) { validate_array($command) }
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: 3 additions & 2 deletions manifests/object/dependency.pp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
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 @@ -114,7 +115,7 @@
if $disable_notifications { validate_bool ( $disable_notifications ) }
if $ignore_soft_states { validate_bool ( $ignore_soft_states ) }
if $period { validate_string ( $period ) }
if $states { $_states = any2array($states) } else { $_states = undef }
if $states { validate_array ( $states ) }

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

# create object
Expand Down
1 change: 1 addition & 0 deletions manifests/object/eventcommand.pp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
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
8 changes: 4 additions & 4 deletions manifests/object/host.pp
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,17 @@
# 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 $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]?$') }
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: 4 additions & 2 deletions manifests/object/hostgroup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@
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 { $_groups = any2array($groups) } else { $_groups = undef }
if $groups { validate_array($groups) }

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

# create object
Expand Down
33 changes: 18 additions & 15 deletions manifests/object/notification.pp
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,24 @@
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 { $_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 }
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) }

if $ignore != [] and $assign == [] {
fail('When attribute ignore is used, assign must be set.')
Expand All @@ -135,15 +138,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: 4 additions & 2 deletions manifests/object/notificationcommand.pp
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,20 @@
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 $command { $_command = any2array($command) } else { $_command = undef }
if !is_array($command) { validate_string($command) }
if !is_string($command) { validate_array($command) }
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: 6 additions & 10 deletions manifests/object/scheduleddowntime.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@
# 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 @@ -31,16 +29,14 @@
# 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
43 changes: 22 additions & 21 deletions manifests/object/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -201,42 +201,43 @@
"${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) }
if $display_name { validate_string ($display_name) }
if $host_name { validate_string($host_name) }
if $groups { $_groups = any2array($groups) } else { $_groups = undef }
if $groups { validate_array ($groups) }
if $check_command { validate_string($check_command) }
if $max_check_attempts { validate_integer($max_check_attempts) }
if $check_period { validate_string($check_period) }
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