From cb066f51d68d5cc685ee1be5a9779be6fd0cc212 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Tue, 7 Nov 2023 21:17:45 +0100 Subject: [PATCH] Remove deprecated group and zbx_groups parameters These were deprecated since 7.0.0 via a4750d47cd21ed8b03722b36df0b05a3fb9ff482 --- REFERENCE.md | 22 ---------------------- lib/puppet/type/zabbix_host.rb | 22 ---------------------- manifests/agent.pp | 20 +------------------- manifests/resources/agent.pp | 15 +-------------- 4 files changed, 2 insertions(+), 77 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 5fe492ce3..db0d350e2 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -1348,7 +1348,6 @@ The following parameters are available in the `zabbix::agent` class: * [`manage_resources`](#-zabbix--agent--manage_resources) * [`monitored_by_proxy`](#-zabbix--agent--monitored_by_proxy) * [`agent_use_ip`](#-zabbix--agent--agent_use_ip) -* [`zbx_group`](#-zabbix--agent--zbx_group) * [`zbx_groups`](#-zabbix--agent--zbx_groups) * [`zbx_group_create`](#-zabbix--agent--zbx_group_create) * [`zbx_templates`](#-zabbix--agent--zbx_templates) @@ -1516,14 +1515,6 @@ connection should me made via ip, not fqdn. Default value: `$zabbix::params::agent_use_ip` -##### `zbx_group` - -Data type: `Any` - -*Deprecated* (see zbx_groups) Name of the hostgroup where this host needs to be added. - -Default value: `$zabbix::params::agent_zbx_group` - ##### `zbx_groups` Data type: `Variant[String[1],Array[String[1]]]` @@ -3607,7 +3598,6 @@ The following parameters are available in the `zabbix::resources::agent` class: * [`ipaddress`](#-zabbix--resources--agent--ipaddress) * [`use_ip`](#-zabbix--resources--agent--use_ip) * [`port`](#-zabbix--resources--agent--port) -* [`group`](#-zabbix--resources--agent--group) * [`groups`](#-zabbix--resources--agent--groups) * [`group_create`](#-zabbix--resources--agent--group_create) * [`templates`](#-zabbix--resources--agent--templates) @@ -3652,14 +3642,6 @@ The port that the zabbix agent is listening on. Default value: `undef` -##### `group` - -Data type: `Any` - -*Deprecated* (see groups parameter) Name of the hostgroup. - -Default value: `undef` - ##### `groups` Data type: `Array[String[1]]` @@ -6014,10 +5996,6 @@ The basic property that the resource should be in. Default value: `present` -##### `group` - -Deprecated! Name of the hostgroup. - ##### `groups` An array of groups the host belongs to. diff --git a/lib/puppet/type/zabbix_host.rb b/lib/puppet/type/zabbix_host.rb index e1f605e29..a8b1f443b 100644 --- a/lib/puppet/type/zabbix_host.rb +++ b/lib/puppet/type/zabbix_host.rb @@ -9,16 +9,6 @@ defaultto :present end - def initialize(*args) - super - - # Migrate group to groups - return if self[:group].nil? - - self[:groups] = self[:group] - delete(:group) - end - def munge_boolean(value) case value when true, 'true', :true @@ -96,14 +86,6 @@ def insync?(is) end end - newproperty(:group) do - desc 'Deprecated! Name of the hostgroup.' - - validate do |_value| - Puppet.warning('Passing group to zabbix_host is deprecated and will be removed. Use groups instead.') - end - end - newproperty(:groups, array_matching: :all) do desc 'An array of groups the host belongs to.' def insync?(is) @@ -170,8 +152,4 @@ def insync?(is) end autorequire(:file) { '/etc/zabbix/api.conf' } - - validate do - raise(_('The properties group and groups are mutually exclusive.')) if self[:group] && self[:groups] - end end diff --git a/manifests/agent.pp b/manifests/agent.pp index 61252c45e..560b9f927 100644 --- a/manifests/agent.pp +++ b/manifests/agent.pp @@ -23,7 +23,6 @@ # @param agent_use_ip # When true, when creating hosts via the zabbix-api, it will configure that # connection should me made via ip, not fqdn. -# @param zbx_group *Deprecated* (see zbx_groups) Name of the hostgroup where this host needs to be added. # @param zbx_groups An array of hostgroups where this host needs to be added. # @param zbx_group_create Whether to create hostgroup if missing. # @param zbx_templates List of templates which will be added when host is configured. @@ -148,7 +147,6 @@ Boolean $manage_resources = $zabbix::params::manage_resources, $monitored_by_proxy = $zabbix::params::monitored_by_proxy, $agent_use_ip = $zabbix::params::agent_use_ip, - $zbx_group = $zabbix::params::agent_zbx_group, Variant[String[1],Array[String[1]]] $zbx_groups = $zabbix::params::agent_zbx_groups, $zbx_group_create = $zabbix::params::agent_zbx_group_create, $zbx_templates = $zabbix::params::agent_zbx_templates, @@ -236,22 +234,6 @@ # is set to false, you'll get warnings like this: # "Warning: You cannot collect without storeconfigs being set" if $manage_resources { - # Migrate deprecated zbx_group parameter - if $zbx_group == $zabbix::params::agent_zbx_group and $zbx_groups == $zabbix::params::agent_zbx_groups { - $groups = $zabbix::params::agent_zbx_groups - } else { - if $zbx_group != $zabbix::params::agent_zbx_group and $zbx_groups != $zabbix::params::agent_zbx_groups { - fail("Seems like you have filled zbx_group and zbx_groups with custom values. This isn't support! Please use zbx_groups only.") - } - - if $zbx_group != $zabbix::params::agent_zbx_group { - warning('Passing zbx_group to zabbix::agent is deprecated and will be removed. Use zbx_groups instead.') - $groups = Array($zbx_group) - } else { - $groups = $zbx_groups - } - } - if $monitored_by_proxy != '' { $use_proxy = $monitored_by_proxy } else { @@ -264,7 +246,7 @@ ipaddress => $listen_ip, use_ip => $agent_use_ip, port => $listenport, - groups => [$groups].flatten(), + groups => [$zbx_groups].flatten(), group_create => $zbx_group_create, templates => $zbx_templates, macros => $zbx_macros, diff --git a/manifests/resources/agent.pp b/manifests/resources/agent.pp index 4a910954d..8e2b4b433 100644 --- a/manifests/resources/agent.pp +++ b/manifests/resources/agent.pp @@ -3,7 +3,6 @@ # @param ipaddress The IP address of the machine running zabbix agent. # @param use_ip Use ipadress instead of dns to connect. # @param port The port that the zabbix agent is listening on. -# @param group *Deprecated* (see groups parameter) Name of the hostgroup. # @param groups An array of groups the host belongs to. # @param group_create Whether to create hostgroup if missing. # @param templates List of templates which should be attached to this host. @@ -20,7 +19,6 @@ $ipaddress = undef, $use_ip = undef, $port = undef, - $group = undef, Array[String[1]] $groups = undef, $group_create = undef, $templates = undef, @@ -33,22 +31,11 @@ Optional[String[1]] $tls_issuer = undef, Optional[String[1]] $tls_subject = undef, ) { - if $group and $groups { - fail("Got group and groups. This isn't support! Please use groups only.") - } else { - if $group { - warning('Passing group to zabbix::resources::agent is deprecated and will be removed. Use groups instead.') - $_groups = Array($group) - } else { - $_groups = $groups - } - } - @@zabbix_host { $hostname: ipaddress => $ipaddress, use_ip => $use_ip, port => $port, - groups => $_groups, + groups => $groups, group_create => $group_create, templates => $templates, macros => $macros,