From 391c9c038850839c04618b2dd7c991ca71b8de8c Mon Sep 17 00:00:00 2001 From: Phil Friderici Date: Mon, 20 Mar 2023 09:19:34 +0000 Subject: [PATCH 1/3] fix: add documentation to satisfy linting Fixes the following warnings that do pop up while linting: [warn]: Missing documentation for Puppet type alias 'Zabbix::Historyics' at types/historyics.pp:1. [warn]: Missing a description for Puppet provider 'ruby' (resource type 'zabbix_host') at lib/puppet/provider/zabbix_host/ruby.rb:4. [warn]: Missing a description for Puppet provider 'ruby' (resource type 'zabbix_proxy') at lib/puppet/provider/zabbix_proxy/ruby.rb:4. [warn]: Missing a description for Puppet provider 'ruby' (resource type 'zabbix_template') at lib/puppet/provider/zabbix_template/ruby.rb:4. [warn]: Missing a description for Puppet provider 'ruby' (resource type 'zabbix_hostgroup') at lib/puppet/provider/zabbix_hostgroup/ruby.rb:4. [warn]: Missing a description for Puppet provider 'ruby' (resource type 'zabbix_application') at lib/puppet/provider/zabbix_application/ruby.rb:4. [warn]: Missing a description for Puppet provider 'ruby' (resource type 'zabbix_template_host') at lib/puppet/provider/zabbix_template_host/ruby.rb:4. [warn]: Missing a description for Puppet provider 'ruby' (resource type 'zabbix_userparameters') at lib/puppet/provider/zabbix_userparameters/ruby.rb:4. --- REFERENCE.md | 4 ++-- lib/puppet/provider/zabbix_application/ruby.rb | 1 + lib/puppet/provider/zabbix_host/ruby.rb | 1 + lib/puppet/provider/zabbix_hostgroup/ruby.rb | 1 + lib/puppet/provider/zabbix_proxy/ruby.rb | 1 + lib/puppet/provider/zabbix_template/ruby.rb | 1 + lib/puppet/provider/zabbix_template_host/ruby.rb | 1 + lib/puppet/provider/zabbix_userparameters/ruby.rb | 1 + types/historyics.pp | 1 + 9 files changed, 10 insertions(+), 2 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index e41d1806c..1812f72aa 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -51,7 +51,7 @@ ### Data types * [`Zabbix::Databases`](#Zabbix--Databases): Type for supported databases by the zabbix module -* [`Zabbix::Historyics`](#Zabbix--Historyics) +* [`Zabbix::Historyics`](#Zabbix--Historyics): Type for size values in bytes (also allows k/K and m/M as appendix) ## Classes @@ -6343,7 +6343,7 @@ Alias of `Enum['postgresql', 'mysql', 'sqlite']` ### `Zabbix::Historyics` -The Zabbix::Historyics data type. +Type for size values in bytes (also allows k/K and m/M as appendix) Alias of `Optional[Pattern[/^\d+[k|K|m|M]?$/]]` diff --git a/lib/puppet/provider/zabbix_application/ruby.rb b/lib/puppet/provider/zabbix_application/ruby.rb index 1c8dd8d8c..0e08491dd 100644 --- a/lib/puppet/provider/zabbix_application/ruby.rb +++ b/lib/puppet/provider/zabbix_application/ruby.rb @@ -2,6 +2,7 @@ require_relative '../zabbix' Puppet::Type.type(:zabbix_application).provide(:ruby, parent: Puppet::Provider::Zabbix) do + desc 'Puppet provider for Zabbix application using the Zabbix API.2' confine feature: :zabbixapi def template_id diff --git a/lib/puppet/provider/zabbix_host/ruby.rb b/lib/puppet/provider/zabbix_host/ruby.rb index 8132b782c..e2426feeb 100644 --- a/lib/puppet/provider/zabbix_host/ruby.rb +++ b/lib/puppet/provider/zabbix_host/ruby.rb @@ -2,6 +2,7 @@ require_relative '../zabbix' Puppet::Type.type(:zabbix_host).provide(:ruby, parent: Puppet::Provider::Zabbix) do + desc 'Puppet provider for managing Zabbix hosts. It uses the Zabbix API to create, read, update and delete hosts.' confine feature: :zabbixapi def self.instances diff --git a/lib/puppet/provider/zabbix_hostgroup/ruby.rb b/lib/puppet/provider/zabbix_hostgroup/ruby.rb index 3e3d9924f..20ca2080a 100644 --- a/lib/puppet/provider/zabbix_hostgroup/ruby.rb +++ b/lib/puppet/provider/zabbix_hostgroup/ruby.rb @@ -2,6 +2,7 @@ require_relative '../zabbix' Puppet::Type.type(:zabbix_hostgroup).provide(:ruby, parent: Puppet::Provider::Zabbix) do + desc 'Puppet provider for managing Zabbix hostgroups. It defines methods to create, check if exists, and destroy Zabbix hostgroups using the Zabbix API.' confine feature: :zabbixapi def self.instances diff --git a/lib/puppet/provider/zabbix_proxy/ruby.rb b/lib/puppet/provider/zabbix_proxy/ruby.rb index 9df114a93..4e15138e1 100644 --- a/lib/puppet/provider/zabbix_proxy/ruby.rb +++ b/lib/puppet/provider/zabbix_proxy/ruby.rb @@ -2,6 +2,7 @@ require_relative '../zabbix' Puppet::Type.type(:zabbix_proxy).provide(:ruby, parent: Puppet::Provider::Zabbix) do + desc 'Puppet provider for managing Zabbix proxies. It uses the Zabbix API to create, read, update and delete hosts, as well as changing them between active and passive modes.' confine feature: :zabbixapi def initialize(value = {}) diff --git a/lib/puppet/provider/zabbix_template/ruby.rb b/lib/puppet/provider/zabbix_template/ruby.rb index 510bb6752..2f36b7934 100644 --- a/lib/puppet/provider/zabbix_template/ruby.rb +++ b/lib/puppet/provider/zabbix_template/ruby.rb @@ -2,6 +2,7 @@ require_relative '../zabbix' Puppet::Type.type(:zabbix_template).provide(:ruby, parent: Puppet::Provider::Zabbix) do + desc 'Puppet provider that manages Zabbix templates by importing and exporting them in XML format, and creating, updating, or deleting various Zabbix configuration objects. It includes conditional logic based on the Zabbix version being used.' confine feature: :zabbixapi def create diff --git a/lib/puppet/provider/zabbix_template_host/ruby.rb b/lib/puppet/provider/zabbix_template_host/ruby.rb index 32a32d4b8..b5269649e 100644 --- a/lib/puppet/provider/zabbix_template_host/ruby.rb +++ b/lib/puppet/provider/zabbix_template_host/ruby.rb @@ -2,6 +2,7 @@ require_relative '../zabbix' Puppet::Type.type(:zabbix_template_host).provide(:ruby, parent: Puppet::Provider::Zabbix) do + desc 'Puppet provider that manages the association between Zabbix templates and hosts. It allows creating, checking the existence of, and deleting the association between a Zabbix template and a host, using the Zabbix API.' confine feature: :zabbixapi def template_name @template_name ||= @resource[:name].split('@')[0] diff --git a/lib/puppet/provider/zabbix_userparameters/ruby.rb b/lib/puppet/provider/zabbix_userparameters/ruby.rb index b293678ad..a85f966fc 100644 --- a/lib/puppet/provider/zabbix_userparameters/ruby.rb +++ b/lib/puppet/provider/zabbix_userparameters/ruby.rb @@ -2,6 +2,7 @@ require_relative '../zabbix' Puppet::Type.type(:zabbix_userparameters).provide(:ruby, parent: Puppet::Provider::Zabbix) do + desc 'Puppet provider that manages Zabbix user parameters. It allows users to define custom monitoring parameters in Zabbix, and provides methods for creating and checking the existence of a user parameter. It also has a placeholder method for destroying the user parameter.' confine feature: :zabbixapi def create diff --git a/types/historyics.pp b/types/historyics.pp index 053445124..72d51a4e2 100644 --- a/types/historyics.pp +++ b/types/historyics.pp @@ -1 +1,2 @@ +# @summary Type for size values in bytes (also allows k/K and m/M as appendix) type Zabbix::Historyics = Optional[Pattern[/^\d+[k|K|m|M]?$/]] From 48174aab1d0d51185f73a0fc7887b5b098ccf6b1 Mon Sep 17 00:00:00 2001 From: Phil Friderici Date: Mon, 20 Mar 2023 09:29:47 +0000 Subject: [PATCH 2/3] fix: reformat and unify examples --- REFERENCE.md | 28 ++++++++++++------------- lib/puppet/type/zabbix_application.rb | 10 ++++----- lib/puppet/type/zabbix_template_host.rb | 10 ++++----- 3 files changed, 23 insertions(+), 25 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 1812f72aa..149476f4b 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -40,12 +40,12 @@ ### Resource types -* [`zabbix_application`](#zabbix_application): %q(Manage zabbix applications zabbix_application{"app1": ensure => present, template => 'template1', } It Raise excep +* [`zabbix_application`](#zabbix_application): Manage zabbix applications Example: zabbix_application{"app1": ensure => present, template => 'template1', } It Raise exceptio * [`zabbix_host`](#zabbix_host): FQDN of the machine. * [`zabbix_hostgroup`](#zabbix_hostgroup): Manage zabbix hostgroups * [`zabbix_proxy`](#zabbix_proxy): FQDN of the proxy. * [`zabbix_template`](#zabbix_template): The name of template. -* [`zabbix_template_host`](#zabbix_template_host): Link or Unlink template to host. Only for Zabbix < 6.0! Example. Name should be in the format of "template_name@hostname" zabbix_template_ho +* [`zabbix_template_host`](#zabbix_template_host): Link or Unlink template to host. Only for Zabbix < 6.0! Example: zabbix_template_host{ 'mysql_template@db1': ensure => present, } Na * [`zabbix_userparameters`](#zabbix_userparameters): An unique name for this define. ### Data types @@ -5927,17 +5927,15 @@ Default value: `'0644'` ### `zabbix_application` -%q(Manage zabbix applications - - zabbix_application{"app1": - ensure => present, - template => 'template1', - } +Manage zabbix applications +Example: + zabbix_application{"app1": + ensure => present, + template => 'template1', + } It Raise exception on deleting an application which is a part of used template. -) - #### Properties The following properties are available in the `zabbix_application` type. @@ -6250,12 +6248,12 @@ Zabbix version that the template will be installed on. ### `zabbix_template_host` Link or Unlink template to host. Only for Zabbix < 6.0! -Example. -Name should be in the format of "template_name@hostname" -zabbix_template_host{ 'mysql_template@db1': - ensure => present, - } +Example: + zabbix_template_host{ 'mysql_template@db1': + ensure => present, + } +Name should be in the format of "template_name@hostname" #### Properties diff --git a/lib/puppet/type/zabbix_application.rb b/lib/puppet/type/zabbix_application.rb index 065ef84ac..d01307b83 100644 --- a/lib/puppet/type/zabbix_application.rb +++ b/lib/puppet/type/zabbix_application.rb @@ -1,16 +1,16 @@ # frozen_string_literal: true Puppet::Type.newtype(:zabbix_application) do - @doc = %q(Manage zabbix applications + @doc = <<-DOC + Manage zabbix applications + Example: zabbix_application{"app1": ensure => present, template => 'template1', } - - It Raise exception on deleting an application which is a part of used template. - - ) + It Raise exception on deleting an application which is a part of used template. + DOC ensurable do defaultvalues diff --git a/lib/puppet/type/zabbix_template_host.rb b/lib/puppet/type/zabbix_template_host.rb index a55cb4343..1e82ba022 100644 --- a/lib/puppet/type/zabbix_template_host.rb +++ b/lib/puppet/type/zabbix_template_host.rb @@ -3,12 +3,12 @@ Puppet::Type.newtype(:zabbix_template_host) do @doc = <<-DOC Link or Unlink template to host. Only for Zabbix < 6.0! - Example. - Name should be in the format of "template_name@hostname" - zabbix_template_host{ 'mysql_template@db1': - ensure => present, - } + Example: + zabbix_template_host{ 'mysql_template@db1': + ensure => present, + } + Name should be in the format of "template_name@hostname" DOC ensurable do From 9d00e8c65a9b4886aa77a28db2bc6e986c1ef439 Mon Sep 17 00:00:00 2001 From: Phil Friderici Date: Mon, 20 Mar 2023 14:40:46 +0000 Subject: [PATCH 3/3] fix: add documentation to satisfy linting Fixes the following warnings that do pop up while linting: [warn]: Missing a description for Puppet resource property 'ensure' at lib/puppet/type/zabbix_host.rb:4. [warn]: Missing a description for Puppet resource property 'ensure' at lib/puppet/type/zabbix_proxy.rb:4. [warn]: Missing a description for Puppet resource property 'ensure' at lib/puppet/type/zabbix_template.rb:4. [warn]: Missing a description for Puppet resource property 'ensure' at lib/puppet/type/zabbix_hostgroup.rb:6. [warn]: Missing a description for Puppet resource property 'ensure' at lib/puppet/type/zabbix_application.rb:15. [warn]: Missing a description for Puppet resource property 'ensure' at lib/puppet/type/zabbix_template_host.rb:14. [warn]: Missing a description for Puppet resource property 'ensure' at lib/puppet/type/zabbix_userparameters.rb:5. --- REFERENCE.md | 16 ++++++++-------- lib/puppet/type/zabbix_application.rb | 1 + lib/puppet/type/zabbix_host.rb | 3 +++ lib/puppet/type/zabbix_hostgroup.rb | 1 + lib/puppet/type/zabbix_proxy.rb | 3 +++ lib/puppet/type/zabbix_template.rb | 3 +++ lib/puppet/type/zabbix_template_host.rb | 1 + lib/puppet/type/zabbix_userparameters.rb | 3 +++ 8 files changed, 23 insertions(+), 8 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 149476f4b..b91cc2c17 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -41,12 +41,12 @@ ### Resource types * [`zabbix_application`](#zabbix_application): Manage zabbix applications Example: zabbix_application{"app1": ensure => present, template => 'template1', } It Raise exceptio -* [`zabbix_host`](#zabbix_host): FQDN of the machine. +* [`zabbix_host`](#zabbix_host): Manage zabbix hosts * [`zabbix_hostgroup`](#zabbix_hostgroup): Manage zabbix hostgroups -* [`zabbix_proxy`](#zabbix_proxy): FQDN of the proxy. -* [`zabbix_template`](#zabbix_template): The name of template. +* [`zabbix_proxy`](#zabbix_proxy): Manage zabbix proxies +* [`zabbix_template`](#zabbix_template): Manage zabbix templates * [`zabbix_template_host`](#zabbix_template_host): Link or Unlink template to host. Only for Zabbix < 6.0! Example: zabbix_template_host{ 'mysql_template@db1': ensure => present, } Na -* [`zabbix_userparameters`](#zabbix_userparameters): An unique name for this define. +* [`zabbix_userparameters`](#zabbix_userparameters): Manage zabbix user templates ### Data types @@ -5973,7 +5973,7 @@ template to which the application is linked ### `zabbix_host` -FQDN of the machine. +Manage zabbix hosts #### Properties @@ -6112,7 +6112,7 @@ usually discover the appropriate provider for your platform. ### `zabbix_proxy` -FQDN of the proxy. +Manage zabbix proxies #### Properties @@ -6170,7 +6170,7 @@ usually discover the appropriate provider for your platform. ### `zabbix_template` -The name of template. +Manage zabbix templates #### Properties @@ -6289,7 +6289,7 @@ will usually discover the appropriate provider for your platform. ### `zabbix_userparameters` -An unique name for this define. +Manage zabbix user templates #### Properties diff --git a/lib/puppet/type/zabbix_application.rb b/lib/puppet/type/zabbix_application.rb index d01307b83..aa6890074 100644 --- a/lib/puppet/type/zabbix_application.rb +++ b/lib/puppet/type/zabbix_application.rb @@ -13,6 +13,7 @@ DOC ensurable do + desc 'The basic property that the resource should be in.' defaultvalues defaultto :present end diff --git a/lib/puppet/type/zabbix_host.rb b/lib/puppet/type/zabbix_host.rb index a5b929979..e1f605e29 100644 --- a/lib/puppet/type/zabbix_host.rb +++ b/lib/puppet/type/zabbix_host.rb @@ -1,7 +1,10 @@ # frozen_string_literal: true Puppet::Type.newtype(:zabbix_host) do + @doc = 'Manage zabbix hosts' + ensurable do + desc 'The basic property that the resource should be in.' defaultvalues defaultto :present end diff --git a/lib/puppet/type/zabbix_hostgroup.rb b/lib/puppet/type/zabbix_hostgroup.rb index 29c141ee2..01c5161d3 100644 --- a/lib/puppet/type/zabbix_hostgroup.rb +++ b/lib/puppet/type/zabbix_hostgroup.rb @@ -4,6 +4,7 @@ @doc = 'Manage zabbix hostgroups' ensurable do + desc 'The basic property that the resource should be in.' defaultvalues defaultto :present end diff --git a/lib/puppet/type/zabbix_proxy.rb b/lib/puppet/type/zabbix_proxy.rb index bad3b7b1b..39f8d7a41 100644 --- a/lib/puppet/type/zabbix_proxy.rb +++ b/lib/puppet/type/zabbix_proxy.rb @@ -1,7 +1,10 @@ # frozen_string_literal: true Puppet::Type.newtype(:zabbix_proxy) do + @doc = 'Manage zabbix proxies' + ensurable do + desc 'The basic property that the resource should be in.' defaultvalues defaultto :present end diff --git a/lib/puppet/type/zabbix_template.rb b/lib/puppet/type/zabbix_template.rb index 00e552a18..8bcb20016 100644 --- a/lib/puppet/type/zabbix_template.rb +++ b/lib/puppet/type/zabbix_template.rb @@ -1,7 +1,10 @@ # frozen_string_literal: true Puppet::Type.newtype(:zabbix_template) do + @doc = 'Manage zabbix templates' + ensurable do + desc 'The basic property that the resource should be in.' defaultvalues defaultto :present diff --git a/lib/puppet/type/zabbix_template_host.rb b/lib/puppet/type/zabbix_template_host.rb index 1e82ba022..cde6c59f4 100644 --- a/lib/puppet/type/zabbix_template_host.rb +++ b/lib/puppet/type/zabbix_template_host.rb @@ -12,6 +12,7 @@ DOC ensurable do + desc 'The basic property that the resource should be in.' defaultvalues defaultto :present end diff --git a/lib/puppet/type/zabbix_userparameters.rb b/lib/puppet/type/zabbix_userparameters.rb index 13d81b489..cf592e886 100644 --- a/lib/puppet/type/zabbix_userparameters.rb +++ b/lib/puppet/type/zabbix_userparameters.rb @@ -2,7 +2,10 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..')) Puppet::Type.newtype(:zabbix_userparameters) do + @doc = 'Manage zabbix user templates' + ensurable do + desc 'The basic property that the resource should be in.' defaultvalues defaultto :present end