Skip to content

Commit

Permalink
Delete denied parameters from host interfaces (#1356)
Browse files Browse the repository at this point in the history
  • Loading branch information
masa-orca authored Aug 3, 2024
1 parent 87f8e7c commit 1978473
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- zabbix_host - delete denied parameter from interfaces
21 changes: 20 additions & 1 deletion plugins/modules/zabbix_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -966,9 +966,28 @@ def update_exist_interfaces_with_defaults(exist_interfaces):
"privprotocol": 0,
"privpassphrase": ""
}
allowed_fields = [
'hostid',
'type',
'ip',
'dns',
'port',
'useip',
'main',
'details',
'interface_ref',
'items',
'interfaceid'
]
for interface in exist_interfaces:
normalized_interface = interface
denied_fields = list(set(interface.keys()) - set(allowed_fields))
normalized_interface = zabbix_utils.helper_normalize_data(
interface, del_keys=denied_fields
)[0]

new_interface = default_interface.copy()
new_interface.update(interface)
new_interface.update(normalized_interface)
new_interface["details"] = default_interface_details.copy()
if "details" in interface:
new_interface["details"].update(interface["details"])
Expand Down

0 comments on commit 1978473

Please sign in to comment.