Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b89f54b

Browse files
authored
Added notify_if_canceled property to action module (ansible-collections#921)
1 parent d11d61c commit b89f54b

File tree

3 files changed

+798
-780
lines changed

3 files changed

+798
-780
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
minor_changes:
2+
- action module - Added notify_if_canceled property

plugins/modules/zabbix_action.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@
5858
- Can be used when I(event_source=trigger).
5959
type: "bool"
6060
default: true
61+
notify_if_canceled:
62+
description:
63+
- Weather to notify when escalation is canceled.
64+
- Can be used when I(event_source=trigger).
65+
type: "bool"
66+
default: true
6167
esc_period:
6268
type: str
6369
description:
@@ -1151,6 +1157,7 @@ def _construct_parameters(self, **kwargs):
11511157
_params["pause_suppressed"] = "1" if kwargs["pause_in_maintenance"] else "0"
11521158
if LooseVersion(self._zbx_api_version) >= LooseVersion("6.4"):
11531159
_params["pause_symptoms"] = "1" if kwargs["pause_symptoms"] else "0"
1160+
_params["notify_if_canceled"] = "1" if kwargs["notify_if_canceled"] else "0"
11541161

11551162
_params["update_operations"] = kwargs.get("update_operations")
11561163
if "update_operations" in _params and not isinstance(_params.get("update_operations", None), type(None)):
@@ -1504,6 +1511,7 @@ class RecoveryOperations(Operations):
15041511
"""
15051512
Restructures the user defined recovery operations data to fit the Zabbix API requirements
15061513
"""
1514+
15071515
def _construct_operationtype(self, operation):
15081516
"""Construct operation type.
15091517
@@ -1572,6 +1580,7 @@ class AcknowledgeOperations(Operations):
15721580
"""
15731581
Restructures the user defined acknowledge operations data to fit the Zabbix API requirements
15741582
"""
1583+
15751584
def _construct_operationtype(self, operation):
15761585
"""Construct operation type.
15771586
@@ -2177,7 +2186,8 @@ def main():
21772186
["type", "send_message", ["send_to_users", "send_to_groups"], True]
21782187
]
21792188
),
2180-
pause_symptoms=dict(type="bool", required=False, default=True)
2189+
pause_symptoms=dict(type="bool", required=False, default=True),
2190+
notify_if_canceled=dict(type="bool", required=False, default=True)
21812191
))
21822192
module = AnsibleModule(
21832193
argument_spec=argument_spec,
@@ -2202,6 +2212,7 @@ def main():
22022212
recovery_operations = module.params["recovery_operations"]
22032213
acknowledge_operations = module.params["acknowledge_operations"]
22042214
pause_symptoms = module.params["pause_symptoms"]
2215+
notify_if_canceled = module.params["notify_if_canceled"]
22052216

22062217
zapi_wrapper = Zapi(module)
22072218
action = Action(module)
@@ -2227,7 +2238,8 @@ def main():
22272238
pause_in_maintenance=pause_in_maintenance,
22282239
operations=ops.construct_the_data(operations, event_source),
22292240
recovery_operations=recovery_ops.construct_the_data(recovery_operations),
2230-
conditions=fltr.construct_the_data(eval_type, formula, conditions)
2241+
conditions=fltr.construct_the_data(eval_type, formula, conditions),
2242+
notify_if_canceled=notify_if_canceled
22312243
)
22322244

22332245
if LooseVersion(zapi_wrapper._zbx_api_version) >= LooseVersion("6.4"):
@@ -2257,7 +2269,8 @@ def main():
22572269
pause_in_maintenance=pause_in_maintenance,
22582270
operations=ops.construct_the_data(operations, event_source),
22592271
recovery_operations=recovery_ops.construct_the_data(recovery_operations),
2260-
conditions=fltr.construct_the_data(eval_type, formula, conditions)
2272+
conditions=fltr.construct_the_data(eval_type, formula, conditions),
2273+
notify_if_canceled=notify_if_canceled
22612274
)
22622275

22632276
kwargs[argument_spec["acknowledge_operations"]["aliases"][0]] = acknowledge_ops.construct_the_data(acknowledge_operations)

0 commit comments

Comments
 (0)