zabbix_template - enable new update rule to delete missing linked templates (#66747)
* enable new update rule to delete missing linked templates New update rule is available from 4.0.16 and 4.4.4 up. Add check for version and enable new update rule. fixes #66720 * adding fragment file * Update zabbix_template.py * Update zabbix_template.py
This commit is contained in:
parent
99d7f15087
commit
055cf91d02
2 changed files with 11 additions and 0 deletions
|
@ -0,0 +1,3 @@
|
|||
minor_changes:
|
||||
- zabbix_template - adding new update rule templateLinkage.deleteMissing for newer zabbix versions (https://github.com/ansible/ansible/pull/66747).
|
||||
|
|
@ -605,6 +605,14 @@ class Template(object):
|
|||
if LooseVersion(api_version).version[:2] <= LooseVersion('3.2').version:
|
||||
update_rules['applications']['updateExisting'] = True
|
||||
|
||||
# templateLinkage.deleteMissing only available in 4.0 branch higher .16 and higher 4.4.4
|
||||
# it's not available in 4.2 branches or lower 4.0.16
|
||||
if LooseVersion(api_version).version[:2] == LooseVersion('4.0').version and \
|
||||
LooseVersion(api_version).version[:3] >= LooseVersion('4.0.16').version:
|
||||
update_rules['templateLinkage']['deleteMissing'] = True
|
||||
if 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:
|
||||
|
|
Loading…
Reference in a new issue