From b3b08124ad2af3c8dc3702afbdc1e124a78a4a3d Mon Sep 17 00:00:00 2001 From: ONODERA Masaru Date: Fri, 12 Jan 2024 12:07:56 +0000 Subject: [PATCH] Update changelog comment and modify module --- .../fragments/1162-do_not_update_ipmi_options.yml | 2 +- plugins/modules/zabbix_host.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/changelogs/fragments/1162-do_not_update_ipmi_options.yml b/changelogs/fragments/1162-do_not_update_ipmi_options.yml index 745867b37..f85b7a77a 100644 --- a/changelogs/fragments/1162-do_not_update_ipmi_options.yml +++ b/changelogs/fragments/1162-do_not_update_ipmi_options.yml @@ -1,2 +1,2 @@ bugfixes: - - zabbix_host - Don't reset IPMI setting when update inventory + - zabbix_host - Don't reset IPMI setting when update inventory data of a host diff --git a/plugins/modules/zabbix_host.py b/plugins/modules/zabbix_host.py index 177a4ede4..4f8df8779 100644 --- a/plugins/modules/zabbix_host.py +++ b/plugins/modules/zabbix_host.py @@ -523,13 +523,13 @@ def update_host(self, host_name, group_ids, status, host_id, interfaces, exist_i else: # A "plain" host parameters = {"hostid": host_id, "groups": group_ids, "status": status} - if proxy_id >= 0: + if (proxy_id >= 0 and proxy_id != zabbix_host_obj["proxy_hostid"]): parameters["proxy_hostid"] = proxy_id if (visible_name is not None and visible_name != zabbix_host_obj["name"]): parameters["name"] = visible_name - if tls_connect: + if (tls_connect is not None and tls_connect != zabbix_host_obj["tls_connect"]): parameters["tls_connect"] = tls_connect - if tls_accept: + if (tls_accept is not None and tls_accept != zabbix_host_obj["tls_accept"]): parameters["tls_accept"] = tls_accept if tls_psk_identity: parameters["tls_psk_identity"] = tls_psk_identity @@ -541,9 +541,9 @@ def update_host(self, host_name, group_ids, status, host_id, interfaces, exist_i parameters["tls_subject"] = tls_subject if (description is not None and description != zabbix_host_obj["description"]): parameters["description"] = description - if ipmi_authtype: + if (ipmi_authtype is not None and ipmi_authtype != zabbix_host_obj["ipmi_authtype"]): parameters["ipmi_authtype"] = ipmi_authtype - if ipmi_privilege: + if (ipmi_privilege is not None and ipmi_privilege != zabbix_host_obj["ipmi_privilege"]): parameters["ipmi_privilege"] = ipmi_privilege if (ipmi_username is not None and ipmi_username != zabbix_host_obj["ipmi_username"]): parameters["ipmi_username"] = ipmi_username