Skip to content

Commit

Permalink
zabbix_action.py: mediatypeid must not exist in update_operations, an…
Browse files Browse the repository at this point in the history
…d if operationtype=notify_all_involved then opmessage_usr and opmessage_grp must not be used (Zabbix 6.0).
  • Loading branch information
BGmot committed Apr 13, 2022
1 parent 1847045 commit 74a070a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion plugins/modules/zabbix_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,7 @@ def _construct_parameters(self, **kwargs):
_params.pop('ack_shortdata', None)

if LooseVersion(self._zbx_api_version) >= LooseVersion('6.0'):
_params['update_operations'] = kwargs.get('update_operations')
if 'update_operations' in _params and not isinstance(_params.get('update_operations', None), type(None)):
_params.pop('acknowledge_operations', None)
elif isinstance(_params.get('acknowledge_operations', None), list):
Expand Down Expand Up @@ -1392,10 +1393,17 @@ def construct_the_data(self, operations):
}

# Send Message type
if constructed_operation['operationtype'] in ('0', '11'):
if constructed_operation['operationtype'] == '0':
constructed_operation['opmessage'] = self._construct_opmessage(op)
constructed_operation['opmessage_usr'] = self._construct_opmessage_usr(op)
constructed_operation['opmessage_grp'] = self._construct_opmessage_grp(op)
if LooseVersion(self._zbx_api_version) >= LooseVersion('6.0'):
constructed_operation['opmessage'].pop('mediatypeid')

if constructed_operation['operationtype'] == '12':
constructed_operation['opmessage'] = self._construct_opmessage(op)
if LooseVersion(self._zbx_api_version) >= LooseVersion('6.0'):
constructed_operation['opmessage'].pop('mediatypeid')

# Send Command type
if constructed_operation['operationtype'] == '1':
Expand Down

0 comments on commit 74a070a

Please sign in to comment.