From 4d86ba1a7da1bf465d8a0397437d0f2b8c2defc0 Mon Sep 17 00:00:00 2001 From: phox142 Date: Fri, 10 Mar 2023 07:01:26 +0100 Subject: [PATCH] Correction and Bugfix for ip dhcp-server network (#156) * API_DATA > ('ip', 'dhcp-server', 'network') > netmask replace "automatically_computed_from" by 'can_disable=True, remove_value=0' automatically_computed_from does not seem to be used at any place in the code without 'can_disable=True, remove_value=0' task is marked as changed at each execution. * API_DATA > ('ip', 'dhcp-server', 'network') > next-server replace "default=''" by 'can_disable=True' The default in routeros is "no value" and it was not possible to remove a configured next-server * API_DATA > ('ip', 'dhcp-server', 'network') > gateway replace "automatically_computed_from" by "default=''" automatically_computed_from does not seem to be used * API_DATA > ('ip', 'dhcp-server', 'network') > dns-none replace "default=''" by "default=False" * Add changelogs fragment * Update changelogs/fragments/156-ip_dhcp-server_network.yml Co-authored-by: Felix Fontein --------- Co-authored-by: Felix Fontein --- changelogs/fragments/156-ip_dhcp-server_network.yml | 2 ++ plugins/module_utils/_api_data.py | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 changelogs/fragments/156-ip_dhcp-server_network.yml diff --git a/changelogs/fragments/156-ip_dhcp-server_network.yml b/changelogs/fragments/156-ip_dhcp-server_network.yml new file mode 100644 index 0000000..d89f834 --- /dev/null +++ b/changelogs/fragments/156-ip_dhcp-server_network.yml @@ -0,0 +1,2 @@ +minor_changes: + - api_modify - adapt data for API paths ``ip dhcp-server network`` (https://github.com/ansible-collections/community.routeros/pull/156). diff --git a/plugins/module_utils/_api_data.py b/plugins/module_utils/_api_data.py index ec5ae3b..caec1ed 100644 --- a/plugins/module_utils/_api_data.py +++ b/plugins/module_utils/_api_data.py @@ -1356,12 +1356,12 @@ PATHS = { 'comment': KeyInfo(can_disable=True, remove_value=''), 'dhcp-option': KeyInfo(default=''), 'dhcp-option-set': KeyInfo(default=''), - 'dns-none': KeyInfo(default=''), + 'dns-none': KeyInfo(default=False), 'dns-server': KeyInfo(default=''), 'domain': KeyInfo(default=''), - 'gateway': KeyInfo(automatically_computed_from=('address', )), - 'netmask': KeyInfo(automatically_computed_from=('address', )), - 'next-server': KeyInfo(default=''), + 'gateway': KeyInfo(default=''), + 'netmask': KeyInfo(can_disable=True, remove_value=0), + 'next-server': KeyInfo(can_disable=True), 'ntp-server': KeyInfo(default=''), 'wins-server': KeyInfo(default=''), },