From 9a6efc9037a139271825d36e8652245f9dfbbf19 Mon Sep 17 00:00:00 2001 From: Lennart Betz Date: Sat, 21 Sep 2024 06:52:30 +0200 Subject: [PATCH 1/2] Add new data type for retention options --- REFERENCE.md | 28 ++++++++++++++++++++-------- manifests/init.pp | 5 +---- types/retentionoptions.pp | 7 +++++++ 3 files changed, 28 insertions(+), 12 deletions(-) create mode 100644 types/retentionoptions.pp diff --git a/REFERENCE.md b/REFERENCE.md index 863c8ff..c5ae5da 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -24,6 +24,10 @@ Configures IcingaDB * `icingadb::redis::service`: Manage IcingaDB Redis server service * `icingadb::service`: Manage IcingaDB service +### Data types + +* [`IcingaDB::RetentionOptions`](#IcingaDB--RetentionOptions) + ## Classes ### `icingadb` @@ -405,14 +409,7 @@ Default value: `undef` ##### `retention_options` -Data type: - -```puppet -Hash[Enum[ - 'acknowledgement','comment','downtime', - 'flapping','notification','state' - ], Integer[1]] -``` +Data type: `IcingaDB::RetentionOptions` Map of history category to number of days to retain its data in order to enable retention only for specific categories or to override the number @@ -759,3 +756,18 @@ Data type: `Stdlib::Absolutepath` +## Data types + +### `IcingaDB::RetentionOptions` + +The IcingaDB::RetentionOptions data type. + +Alias of + +```puppet +Hash[Enum[ + 'acknowledgement','comment','downtime', + 'flapping','notification','state' + ], Integer[1]] +``` + diff --git a/manifests/init.pp b/manifests/init.pp index 9752057..d29faae 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -178,10 +178,7 @@ Pattern[/^\d+\.?\d*[d|h|m|s]?$/] $logging_interval = '20s', Optional[Integer[1]] $retention_history_data = undef, Optional[Integer[1]] $retention_sla_data = undef, - Hash[Enum[ - 'acknowledgement','comment','downtime', - 'flapping','notification','state' - ], Integer[1]] $retention_options = {}, + IcingaDB::RetentionOptions $retention_options = {}, ) { require icingadb::globals diff --git a/types/retentionoptions.pp b/types/retentionoptions.pp new file mode 100644 index 0000000..eade6c9 --- /dev/null +++ b/types/retentionoptions.pp @@ -0,0 +1,7 @@ +type IcingaDB::RetentionOptions = Hash[ + Enum[ + 'acknowledgement','comment','downtime', + 'flapping','notification','state' + ], + Integer[1] +] From 079f812097533a559f4b1f5717cbd9d8ea3645af Mon Sep 17 00:00:00 2001 From: Lennart Betz Date: Mon, 23 Sep 2024 08:45:27 +0000 Subject: [PATCH 2/2] Add missing comment to data type RetentionOptions --- REFERENCE.md | 6 ++++-- types/retentionoptions.pp | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index c5ae5da..f3eee76 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -26,7 +26,8 @@ Configures IcingaDB ### Data types -* [`IcingaDB::RetentionOptions`](#IcingaDB--RetentionOptions) +* [`IcingaDB::RetentionOptions`](#IcingaDB--RetentionOptions): Data type for retention options of the connection to +the IcingaDB database. ## Classes @@ -760,7 +761,8 @@ Data type: `Stdlib::Absolutepath` ### `IcingaDB::RetentionOptions` -The IcingaDB::RetentionOptions data type. +Data type for retention options of the connection to +the IcingaDB database. Alias of diff --git a/types/retentionoptions.pp b/types/retentionoptions.pp index eade6c9..f922028 100644 --- a/types/retentionoptions.pp +++ b/types/retentionoptions.pp @@ -1,3 +1,6 @@ +# @summary +# Data type for retention options of the connection to +# the IcingaDB database. type IcingaDB::RetentionOptions = Hash[ Enum[ 'acknowledgement','comment','downtime',