Adds minor improvements to 'zabbix_actions' module (#58379)
Changes: 1. Update mandatory arguments in accordance with Zabbix API. Only esc_period, eventsource and name fields are mandatory. Reference: https://www.zabbix.com/documentation/3.0/manual/api/reference/action/object 2. Add default values to argument options in order to prevent "TypeError: 'NoneType' object is not iterable" error. 3. Add new condition operators (introduced in Zabbix 4.0 and 4.2) References: - https://www.zabbix.com/documentation/4.2/manual/api/reference/action/object#action_filter_condition - https://www.zabbix.com/documentation/4.0/manual/api/reference/action/object#action_filter_condition 4. Update module documentation
This commit is contained in:
parent
33d2728879
commit
cc4dc075f7
2 changed files with 17 additions and 7 deletions
|
@ -0,0 +1,3 @@
|
|||
minor_changes:
|
||||
- zabbix_action - ``esc_period`` is now required to reflect actual Zabbix API call
|
||||
- zabbix_action - support for new condition operators (``matches``, ``does not match``, ``Yes``, ``No``) added in Zabbix 4.0 and Zabbix 4.2 (https://www.zabbix.com/documentation/4.2/manual/api/reference/action/object#action_filter_condition)
|
|
@ -63,7 +63,7 @@ options:
|
|||
esc_period:
|
||||
description:
|
||||
- Default operation step duration. Must be greater than 60 seconds. Accepts seconds, time unit with suffix and user macro.
|
||||
default: '60'
|
||||
required: true
|
||||
conditions:
|
||||
type: list
|
||||
description:
|
||||
|
@ -127,6 +127,7 @@ options:
|
|||
description:
|
||||
- Condition operator.
|
||||
- When I(type) is set to C(time_period), the choices are C(in), C(not in).
|
||||
- C(matches), C(does not match), C(Yes) and C(No) condition operators work only with >= Zabbix 4.0
|
||||
choices:
|
||||
- '='
|
||||
- '<>'
|
||||
|
@ -136,6 +137,10 @@ options:
|
|||
- '>='
|
||||
- '<='
|
||||
- 'not in'
|
||||
- 'matches'
|
||||
- 'does not match'
|
||||
- 'Yes'
|
||||
- 'No'
|
||||
formulaid:
|
||||
description:
|
||||
- Arbitrary unique ID that is used to reference the condition from a custom expression.
|
||||
|
@ -1187,8 +1192,6 @@ class RecoveryOperations(Operations):
|
|||
Returns:
|
||||
list: constructed recovery operations data
|
||||
"""
|
||||
if operations is None:
|
||||
return None
|
||||
constructed_data = []
|
||||
for op in operations:
|
||||
operation_type = self._construct_operationtype(op)
|
||||
|
@ -1254,8 +1257,6 @@ class AcknowledgeOperations(Operations):
|
|||
Returns:
|
||||
list: constructed acknowledge operations data
|
||||
"""
|
||||
if operations is None:
|
||||
return None
|
||||
constructed_data = []
|
||||
for op in operations:
|
||||
operation_type = self._construct_operationtype(op)
|
||||
|
@ -1397,7 +1398,11 @@ class Filter(object):
|
|||
"in",
|
||||
">=",
|
||||
"<=",
|
||||
"not in"], _condition['operator']
|
||||
"not in",
|
||||
"matches",
|
||||
"does not match",
|
||||
"Yes",
|
||||
"No"], _condition['operator']
|
||||
)
|
||||
except Exception as e:
|
||||
self._module.fail_json(msg="Unsupported value '%s' for operator." % _condition['operator'])
|
||||
|
@ -1663,7 +1668,7 @@ def main():
|
|||
http_login_user=dict(type='str', required=False, default=None),
|
||||
http_login_password=dict(type='str', required=False, default=None, no_log=True),
|
||||
validate_certs=dict(type='bool', required=False, default=True),
|
||||
esc_period=dict(type='int', required=False, default=60),
|
||||
esc_period=dict(type='int', required=True),
|
||||
timeout=dict(type='int', default=10),
|
||||
name=dict(type='str', required=True),
|
||||
event_source=dict(type='str', required=True, choices=['trigger', 'discovery', 'auto_registration', 'internal']),
|
||||
|
@ -1679,6 +1684,7 @@ def main():
|
|||
conditions=dict(
|
||||
type='list',
|
||||
required=False,
|
||||
default=[],
|
||||
elements='dict',
|
||||
options=dict(
|
||||
formulaid=dict(type='str', required=False),
|
||||
|
@ -1693,6 +1699,7 @@ def main():
|
|||
operations=dict(
|
||||
type='list',
|
||||
required=False,
|
||||
default=[],
|
||||
elements='dict',
|
||||
options=dict(
|
||||
type=dict(
|
||||
|
|
Loading…
Reference in a new issue