Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete denied parameters from host interfaces #1356

Merged
merged 4 commits into from
Aug 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading