From b9fa9116c15f5d6e90eb8626ec67650854429b14 Mon Sep 17 00:00:00 2001 From: spike77453 Date: Tue, 11 May 2021 19:35:30 +0200 Subject: [PATCH] nmcli: Remove dead code, 'options' never contains keys from 'param_alias' (#2417) * nmcli: Remove dead code, 'options' never contains keys from 'param_alias' * Update changelogs/fragments/2417-nmcli_remove_dead_code.yml Co-authored-by: Felix Fontein Co-authored-by: Felix Fontein --- .../fragments/2417-nmcli_remove_dead_code.yml | 2 ++ plugins/modules/net_tools/nmcli.py | 18 ------------------ 2 files changed, 2 insertions(+), 18 deletions(-) create mode 100644 changelogs/fragments/2417-nmcli_remove_dead_code.yml diff --git a/changelogs/fragments/2417-nmcli_remove_dead_code.yml b/changelogs/fragments/2417-nmcli_remove_dead_code.yml new file mode 100644 index 0000000000..9d94c393fa --- /dev/null +++ b/changelogs/fragments/2417-nmcli_remove_dead_code.yml @@ -0,0 +1,2 @@ +minor_changes: + - nmcli - remove dead code, ``options`` never contains keys from ``param_alias`` (https://github.com/ansible-collections/community.general/pull/2417). diff --git a/plugins/modules/net_tools/nmcli.py b/plugins/modules/net_tools/nmcli.py index e2ed4ad572..929d88c654 100644 --- a/plugins/modules/net_tools/nmcli.py +++ b/plugins/modules/net_tools/nmcli.py @@ -1036,17 +1036,6 @@ class Nmcli(object): return conn_info def _compare_conn_params(self, conn_info, options): - # See nmcli(1) for details - param_alias = { - 'type': 'connection.type', - 'con-name': 'connection.id', - 'autoconnect': 'connection.autoconnect', - 'ifname': 'connection.interface-name', - 'master': 'connection.master', - 'slave-type': 'connection.slave-type', - 'zone': 'connection.zone', - } - changed = False diff_before = dict() diff_after = dict() @@ -1070,13 +1059,6 @@ class Nmcli(object): value = value.upper() # ensure current_value is also converted to uppercase in case nmcli changes behaviour current_value = current_value.upper() - elif key in param_alias: - real_key = param_alias[key] - if real_key in conn_info: - current_value = conn_info[real_key] - else: - # alias parameter does not exist - current_value = None else: # parameter does not exist current_value = None