summaryrefslogtreecommitdiffstats
path: root/roles/lib_zabbix
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2015-09-22 15:33:39 -0400
committerKenny Woodson <kwoodson@redhat.com>2015-09-22 15:33:39 -0400
commit176258e9c9e9254fed8ba997a80a0262b5e2ede5 (patch)
tree78c71a351af3b260d077afd4935bee94446ee9ac /roles/lib_zabbix
parentb800a153702168419d93ca82c8fa28f009bb64be (diff)
downloadopenshift-176258e9c9e9254fed8ba997a80a0262b5e2ede5.tar.gz
openshift-176258e9c9e9254fed8ba997a80a0262b5e2ede5.tar.bz2
openshift-176258e9c9e9254fed8ba997a80a0262b5e2ede5.tar.xz
openshift-176258e9c9e9254fed8ba997a80a0262b5e2ede5.zip
Fixed a bug and removed the need for template and discoveryrule
Diffstat (limited to 'roles/lib_zabbix')
-rw-r--r--roles/lib_zabbix/library/zbx_discoveryrule.py2
-rw-r--r--roles/lib_zabbix/library/zbx_itemprototype.py12
2 files changed, 5 insertions, 9 deletions
diff --git a/roles/lib_zabbix/library/zbx_discoveryrule.py b/roles/lib_zabbix/library/zbx_discoveryrule.py
index 71141bd54..f32267818 100644
--- a/roles/lib_zabbix/library/zbx_discoveryrule.py
+++ b/roles/lib_zabbix/library/zbx_discoveryrule.py
@@ -183,8 +183,6 @@ def main():
module.exit_json(changed=False, results=zab_results, state="present")
# We have differences and need to update
- module.exit_json(failed=True, changed=False, results=differences, state="present")
-
differences[idname] = zab_results[idname]
content = zapi.get_content(zbx_class_name, 'update', differences)
diff --git a/roles/lib_zabbix/library/zbx_itemprototype.py b/roles/lib_zabbix/library/zbx_itemprototype.py
index b93b7729e..75b9e25b7 100644
--- a/roles/lib_zabbix/library/zbx_itemprototype.py
+++ b/roles/lib_zabbix/library/zbx_itemprototype.py
@@ -157,10 +157,8 @@ def main():
value_type=dict(default='float', type='str'),
delay=dict(default=60, type='int'),
lifetime=dict(default=30, type='int'),
- template_name=dict(default=None, required=True, type='str'),
state=dict(default='present', type='str'),
status=dict(default='enabled', type='str'),
- discoveryrule_name=dict(default=None, required=True, type='str'),
applications=dict(default=[], type='list'),
),
#supports_check_mode=True
@@ -175,14 +173,14 @@ def main():
zbx_class_name = 'itemprototype'
idname = "itemid"
state = module.params['state']
- template = get_template(zapi, module.params['template_name'])
# selectInterfaces doesn't appear to be working but is needed.
content = zapi.get_content(zbx_class_name,
'get',
- {'search': {'name': module.params['name']},
+ {'search': {'key_': module.params['key']},
'selectApplications': 'applicationid',
'selectDiscoveryRule': 'itemid',
+ 'templated': True,
})
#******#
@@ -205,9 +203,9 @@ def main():
if state == 'present':
params = {'name': module.params['name'],
'key_': module.params['key'],
- 'hostid': template['templateid'],
+ 'hostid': content['result'][0]['hostid'],
'interfaceid': module.params['interfaceid'],
- 'ruleid': get_rule_id(zapi, module.params['discoveryrule_name'], template['templateid']),
+ 'ruleid': content['result'][0]['discoveryRule']['itemid'],
'type': get_type(module.params['ztype']),
'value_type': get_value_type(module.params['value_type']),
'applications': get_app_ids(zapi, module.params['applications']),
@@ -226,7 +224,7 @@ def main():
content = zapi.get_content(zbx_class_name, 'create', params)
if content.has_key('error'):
- module.exit_json(failed=True, changed=True, results=content['error'], state="present")
+ module.exit_json(failed=True, changed=False, results=content['error'], state="present")
module.exit_json(changed=True, results=content['result'], state='present')