community.zabbix
community.zabbix copied to clipboard
zabbix_action: condition value considered required when it should not be
From @richlv on 10 Jan
SUMMARY
According to the Zabbix manual, the condition type "Problem is suppressed" has: "No value required".
ISSUE TYPE
- Bug Report
COMPONENT NAME
zabbix_action
ANSIBLE VERSION
latest
STEPS TO REPRODUCE
"Problem is suppressed" matches maintenance_status
in zabbix_action
(value 16).
Try an action with a condition like so:
- type: 'maintenance_status'
operator: 'No'
EXPECTED RESULTS
Action created.
ACTUAL RESULTS
Fails with:
missing required arguments: value found in conditions
Copied from original issue: https://github.com/ansible/ansible/issues/66343
Only way I see this fixed is by changing modules.argument_spec.conditions.options.value
from required=True
to required=False
and then specifying that it is required for almost every condition type:
conditions=dict(
type='list',
required=False,
default=[],
elements='dict',
options=dict(
formulaid=dict(type='str', required=False),
operator=dict(type='str', required=True),
type=dict(type='str', required=True),
value=dict(type='str', required=False),
value2=dict(type='str', required=False)
),
required_if=[
['type', 'host_group', ['value']],
['type', 'host', ['value']],
# and so on ....
]
),
required_if
entry would need to be specified for every condition type, except type 16 (Maintenance status/Problem is suppressed). That means 25 times...
This module is unfortunately too complex and would probably needs some more love in the future when 3.0LTS gets deprecated as it is using old naming for a few things.
#774 seems to drop support for Zabbix 3.0, does that make this issue any easier?