Skip to content

Commit

Permalink
add new update rule for deleteMissing linked templates
Browse files Browse the repository at this point in the history
fixes ansible#66720

adding a check for versions >= 4.0.16 or >= 4.4.4 to enable deleteMissing for templateLinkage
  • Loading branch information
rockaut committed Jan 24, 2020
1 parent 68ab8c2 commit 0b2a8ae
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/ansible/modules/monitoring/zabbix/zabbix_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,10 @@ def import_template(self, template_content, template_type='json'):
if LooseVersion(api_version).version[:2] <= LooseVersion('3.2').version:
update_rules['applications']['updateExisting'] = True

if ( LooseVersion(api_version).version[:3] >= LooseVersion('4.4.4').version ) or \
( LooseVersion(api_version).version[:3] >= LooseVersion('4.4.4').version ):
update_rules['templateLinkage']['deleteMissing'] = True

import_data = {'format': template_type, 'source': template_content, 'rules': update_rules}
self._zapi.configuration.import_(import_data)
except ZabbixAPIException as e:
Expand Down

0 comments on commit 0b2a8ae

Please sign in to comment.