summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Woodson <mwoodson@gmail.com>2015-09-03 15:46:17 -0400
committerMatt Woodson <mwoodson@gmail.com>2015-09-03 15:46:17 -0400
commitdf17c2619a38cf9a0397b23328092bdc12344afe (patch)
tree8e70fa34752097cb5015cb93d93f806fc5d1cf44
parentf25e1d9954b6c614b7890fe5f0b60fb83b165f65 (diff)
parentd1542a1df3c0e08a759f659b661b65b07d1e4678 (diff)
downloadopenshift-df17c2619a38cf9a0397b23328092bdc12344afe.tar.gz
openshift-df17c2619a38cf9a0397b23328092bdc12344afe.tar.bz2
openshift-df17c2619a38cf9a0397b23328092bdc12344afe.tar.xz
openshift-df17c2619a38cf9a0397b23328092bdc12344afe.zip
Merge pull request #557 from kwoodson/triggerurl
Added support for trigger urls
-rw-r--r--roles/lib_zabbix/library/zbx_trigger.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/roles/lib_zabbix/library/zbx_trigger.py b/roles/lib_zabbix/library/zbx_trigger.py
index c707a2f64..c384f6fa3 100644
--- a/roles/lib_zabbix/library/zbx_trigger.py
+++ b/roles/lib_zabbix/library/zbx_trigger.py
@@ -101,6 +101,7 @@ def main():
description=dict(default=None, type='str'),
dependencies=dict(default=[], type='list'),
priority=dict(default='avg', type='str'),
+ url=dict(default=None, type='str'),
state=dict(default='present', type='str'),
),
#supports_check_mode=True
@@ -123,28 +124,41 @@ def main():
'expandExpression': True,
'selectDependencies': 'triggerid',
})
+
+ # Get
if state == 'list':
module.exit_json(changed=False, results=content['result'], state="list")
+ # Delete
if state == 'absent':
if not exists(content):
module.exit_json(changed=False, state="absent")
content = zapi.get_content(zbx_class_name, 'delete', [content['result'][0][idname]])
module.exit_json(changed=True, results=content['result'], state="absent")
+ # Create and Update
if state == 'present':
params = {'description': description,
'expression': module.params['expression'],
'dependencies': get_deps(zapi, module.params['dependencies']),
'priority': get_priority(module.params['priority']),
+ 'url': module.params['url'],
}
+ # Remove any None valued params
+ _ = [params.pop(key, None) for key in params.keys() if params[key] is None]
+
+ #******#
+ # CREATE
+ #******#
if not exists(content):
# if we didn't find it, create it
content = zapi.get_content(zbx_class_name, 'create', params)
module.exit_json(changed=True, results=content['result'], state='present')
- # already exists, we need to update it
- # let's compare properties
+
+ ########
+ # UPDATE
+ ########
differences = {}
zab_results = content['result'][0]
for key, value in params.items():