Closed djdejawu closed 3 months ago
Yep looks like you're right. The code doesn't handle not having an eventsource
set for some reason even though the documentation says its not required.
if self._module.params["message_templates"]:
msg_templates = []
for template in self._module.params["message_templates"]:
msg_templates.append(dict(
eventsource={
"triggers": "0",
"discovery": "1",
"autoregistration": "2",
"internal": "3"}.get(template["eventsource"]),
recovery={
"operations": "0",
"recovery_operations": "1",
"update_operations": "2"}.get(template["recovery"]),
subject=template["subject"],
message=template["body"]
))
parameters.update(dict(message_templates=msg_templates))
Kinda surprised they never got caught before.
OK I stand corrected. We have a problem with documentation, not the code. Looking at the actual API documentation for Zabbix (https://www.zabbix.com/documentation/current/en/manual/api/reference/mediatype/object#message-template), all message templates need to have an eventsource and a recovery parameter defined.
So, in fact:
eventsource: triggers
recovery: operations
this two attributes is required.
You need to update documents, because this is misunderstanding.
SUMMARY
Create a new E-mail notification
ISSUE TYPE
COMPONENT NAME
community.zabbix.zabbix_mediatype
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT / Zabbix Version
Debian 11, Zabbix 6.0.30
STEPS TO REPRODUCE
EXPECTED RESULTS
Message templates in media type
ACTUAL RESULTS
type error