Drop zabbix_application support for zabbix 5.4
* Zabbix applications were replaced with Item tags in version 5.4
* applications and screens parameters were removed from configurations.import
* selectApplications parameter was removed from templates.get in version 5.4
Source:
MODIFY
lib/puppet/provider/zabbix_template/ruby.rb
lib/puppet/provider/zabbix_template/ruby.rb
@@ -6,7 +6,8 @@ Puppet::Type.type(:zabbix_template).provide(:ruby, parent: Puppet::Provider::Zab
zbx.configurations.import(
format: 'xml',
rules: {
- applications: {
+ # application parameter was removed on Zabbix 5.4
+ (@resource[:zabbix_version] =~ %r{[45]\.[02]} ? :applications : nil) => {
createMissing: true
},
discoveryRules: {
@@ -32,7 +33,8 @@ Puppet::Type.type(:zabbix_template).provide(:ruby, parent: Puppet::Provider::Zab
createMissing: true,
updateExisting: true
},
- screens: {
+ # screens parameter was removed on Zabbix 5.4
+ (@resource[:zabbix_version] =~ %r{[45]\.[02]} ? :screens : nil) => {
createMissing: true,
updateExisting: true
},
@@ -43,7 +45,8 @@ Puppet::Type.type(:zabbix_template).provide(:ruby, parent: Puppet::Provider::Zab
createMissing: true,
updateExisting: true
},
- (@resource[:zabbix_version] =~ %r{5\.[^0]} ? :templateDashboards : :templateScreens) => {
+ # templateDashboards was renamed to templateScreen on Zabbix >= 5.2
+ (@resource[:zabbix_version] =~ %r{5\.[24]} ? :templateDashboards : :templateScreens) => {
createMissing: true,
updateExisting: true
},
@@ -51,7 +54,7 @@ Puppet::Type.type(:zabbix_template).provide(:ruby, parent: Puppet::Provider::Zab
createMissing: true,
updateExisting: true
}
- },
+ }.delete_if { |key, _| key.nil? },
source: template_contents
)
end

MODIFY
spec/acceptance/zabbix_application_spec.rb
spec/acceptance/zabbix_application_spec.rb
@@ -4,6 +4,8 @@ describe 'zabbix_application type', unless: default[:platform] =~ %r{(ubuntu-16.
%w[4.0 5.0 5.2].each do |zabbix_version|
# 5.2 server packages are not available for RHEL 7
next if zabbix_version == '5.2' && default[:platform] == 'el-7-x86_64'
+ # Application API was removed in Zabbix 5.4
+ next if zabbix_version == '5.4'
template = case zabbix_version
when '4.0'

MODIFY
spec/acceptance/zabbix_template_spec.rb
spec/acceptance/zabbix_template_spec.rb
@@ -57,7 +57,12 @@ describe 'zabbix_template type', unless: default[:platform] =~ %r{(ubuntu-16.04|
end
let(:result_templates) do
+ # selectApplications parameter was removed in Zabbix 5.4
+ if zabbix_version =~ %r{5\.[^4]}
zabbixapi('localhost', 'Admin', 'zabbix', 'template.get', selectApplications: ['name'], output: ['host']).result
+ else
+ zabbixapi('localhost', 'Admin', 'zabbix', 'template.get', output: ['host']).result
+ end
end
context 'TestTemplate1' do

Drop zabbix_application support for zabbix 5.4

* Zabbix applications were replaced with Item tags in version 5.4
* applications and screens parameters were removed from configurations.import
* selectApplications parameter was removed from templates.get in version 5.4

Source: https://www.zabbix.com/documentation/5.4/manual/api/changes_5.2_-_5.4

Signed-off-by: Christos Papageorgiou <root.expert.xda@gmail.com>