From a090e2ff85fb39f2a19daf01cb9472f527dd7960 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Mon, 3 May 2021 07:59:58 +0200 Subject: [PATCH] nmcli: Add 'slave-type bridge' to nmcli command if type is bridge-slave (#2409) (#2422) (cherry picked from commit b5f8ae43204748c7f9e1719296ef81931c56c296) Co-authored-by: spike77453 --- ...ave-type_bridge_to_nmcli_command_if_type_is_bridge-slave.yml | 2 ++ plugins/modules/net_tools/nmcli.py | 1 + tests/unit/plugins/modules/net_tools/test_nmcli.py | 1 + 3 files changed, 4 insertions(+) create mode 100644 changelogs/fragments/2409-nmcli_add_slave-type_bridge_to_nmcli_command_if_type_is_bridge-slave.yml diff --git a/changelogs/fragments/2409-nmcli_add_slave-type_bridge_to_nmcli_command_if_type_is_bridge-slave.yml b/changelogs/fragments/2409-nmcli_add_slave-type_bridge_to_nmcli_command_if_type_is_bridge-slave.yml new file mode 100644 index 0000000000..8d0b4c1617 --- /dev/null +++ b/changelogs/fragments/2409-nmcli_add_slave-type_bridge_to_nmcli_command_if_type_is_bridge-slave.yml @@ -0,0 +1,2 @@ +bugfixes: + - nmcli - if type is ``bridge-slave`` add ``slave-type bridge`` to ``nmcli`` command (https://github.com/ansible-collections/community.general/issues/2408). diff --git a/plugins/modules/net_tools/nmcli.py b/plugins/modules/net_tools/nmcli.py index 2967996f3c..c17af6e533 100644 --- a/plugins/modules/net_tools/nmcli.py +++ b/plugins/modules/net_tools/nmcli.py @@ -752,6 +752,7 @@ class Nmcli(object): }) elif self.type == 'bridge-slave': options.update({ + 'connection.slave-type': 'bridge', 'bridge-port.path-cost': self.path_cost, 'bridge-port.hairpin-mode': self.hairpin, 'bridge-port.priority': self.slavepriority, diff --git a/tests/unit/plugins/modules/net_tools/test_nmcli.py b/tests/unit/plugins/modules/net_tools/test_nmcli.py index 8d830bcf19..a05c8ccbf8 100644 --- a/tests/unit/plugins/modules/net_tools/test_nmcli.py +++ b/tests/unit/plugins/modules/net_tools/test_nmcli.py @@ -223,6 +223,7 @@ TESTCASE_BRIDGE_SLAVE_SHOW_OUTPUT = """\ connection.id: non_existent_nw_device connection.interface-name: br0_non_existant connection.autoconnect: yes +connection.slave-type: bridge ipv4.never-default: no bridge-port.path-cost: 100 bridge-port.hairpin-mode: yes