From ef1426fd8a44c0d7f8dd66f13309d5b02517cc66 Mon Sep 17 00:00:00 2001 From: David Raison Date: Sun, 27 Nov 2016 17:01:29 +0100 Subject: [PATCH] Fix documentation and icinga2::object::timeperiod aspects. - Remove duplicate target parameter section in icinga2::object::timeperiod documentation. - No "update" parameter on timeperiod objects, but instead "import" - Fix validation (array, not string) on timeperiods excludes and includes --- README.md | 16 ++++++---------- manifests/object/timeperiod.pp | 17 +++++------------ 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 53b27b595..a55c31317 100644 --- a/README.md +++ b/README.md @@ -336,11 +336,11 @@ Strings are parsed in chunks, by splitting the original string into separate sub such as `+`, `-`, `in`, `&&`, `||`, etc. **NOTICE**: This splitting only works for keywords that are surrounded by whitespace, e.g.: -``` +``` attr => 'string1 + string2 - string3' ``` -The algorithm will loop over the parameter and start by splitting it into 'string1' and 'string2 - string3'. +The algorithm will loop over the parameter and start by splitting it into 'string1' and 'string2 - string3'. 'string1' will be passed to the sub function 'value_types' and then the algorithm will continue parsing the rest of the string ('string2 - string3'), splitting it, passing it to value_types, etc. @@ -419,7 +419,7 @@ icinga2::object::notification { 'testnotification': ignore => [ 'host.vars.os == Windows' ], user_groups => ['icingaadmins'] } -``` +``` Assign all Linux hosts to a hostgroup: ``` puppet @@ -1363,9 +1363,8 @@ Set to present enables the endpoint object, absent disabled it. Defaults to `pre ##### `display_name` A short description of the time period. -##### `update` -The "update" script method takes care of updating the internal representation of the time period. In virtually all cases -you should import the "legacy-timeperiod" template to take care of this setting. +##### `import` +Sorted List of templates to include. Defaults to [ "legacy-timeperiod" ]. ##### `ranges` A dictionary containing information which days and durations apply to this timeperiod. @@ -1383,10 +1382,7 @@ An array of timeperiods, which should include into your timerange Set to true creates a template instead of an object. Defaults to `false` ##### `target` -Destination config file to store in this object. File will be declared the first time. - -##### `target` -Destination config file to store in this object. File will be declared at the first time. +Destination config file to store this object in. File will be declared on the first run. ##### `order` String to control the position in the target file, sorted alpha numeric. diff --git a/manifests/object/timeperiod.pp b/manifests/object/timeperiod.pp index 5141ece47..f567003b6 100644 --- a/manifests/object/timeperiod.pp +++ b/manifests/object/timeperiod.pp @@ -10,10 +10,8 @@ # [*display_name*] # A short description of the time period. # -# [*update*] -# The "update" script method takes care of updating the internal -# representation of the time period. In virtually all cases you should import -# the "legacy-timeperiod" template to take care of this setting. +# [*import*] +# Sorted List of templates to include. Defaults to [ "legacy-timeperiod" ]. # # [*ranges*] # A dictionary containing information which days and durations apply to this @@ -32,12 +30,7 @@ # Set to true creates a template instead of an object. Defaults to false. # # [*target*] -# Destination config file to store in this object. File will be declared the -# first time. -# -# [*target*] -# Destination config file to store in this object. File will be declared at the -# first time. +# Destination config file to store this object in. File will be declared on the first run. # # [*order*] # String to control the position in the target file, sorted alpha numeric. @@ -75,8 +68,8 @@ if $display_name { validate_string ($display_name) } validate_hash ($ranges) if $prefer_includes { validate_bool ($prefer_includes) } - if $excludes { validate_string ($excludes) } - if $includes { validate_string ($includes) } + if $excludes { validate_array ($excludes) } + if $includes { validate_array ($includes) } # compose attributes $attrs = {