From 5b2d01566fd8eee0ada97bcfa57def532f3c7ff0 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Thu, 4 Mar 2021 08:27:34 +0100 Subject: [PATCH] Fix: nmcli - Ensure slave-type for bond-slave (#1882) (#1960) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix: nmcli - Ensure slave-type for bond-slave Hello 🙂 When using bond-slave type, by default command sent to nmcl is: ['/usr/bin/nmcli', 'con', 'add', 'type', 'bond-slave', 'con-name', 'enp129s0f0', 'connection.interface-name', 'enp129s0f0', 'connection.autoconnect', 'yes', 'connection.master', 'bond0'] Which is not enough, nmcli will complain that connection.slave-type is missing. This small fix solve this issue. If this change is approved, I will add the changelog fragment. * Fix: nmcli - Adding changelog fragment for 1882 * Update changelogs/fragments/1882-fix-nmcli-ensure-slave-type-for-bond-slave.yml Co-authored-by: Felix Fontein Co-authored-by: Felix Fontein (cherry picked from commit dec345b818c47198c0e1c1f846a528ba02d22b63) Co-authored-by: Ox --- .../1882-fix-nmcli-ensure-slave-type-for-bond-slave.yml | 2 ++ plugins/modules/net_tools/nmcli.py | 4 ++++ 2 files changed, 6 insertions(+) create mode 100644 changelogs/fragments/1882-fix-nmcli-ensure-slave-type-for-bond-slave.yml diff --git a/changelogs/fragments/1882-fix-nmcli-ensure-slave-type-for-bond-slave.yml b/changelogs/fragments/1882-fix-nmcli-ensure-slave-type-for-bond-slave.yml new file mode 100644 index 0000000000..47569b6a24 --- /dev/null +++ b/changelogs/fragments/1882-fix-nmcli-ensure-slave-type-for-bond-slave.yml @@ -0,0 +1,2 @@ +bugfixes: + - nmcli - ensure the ``slave-type`` option is passed to ``nmcli`` for type ``bond-slave`` (https://github.com/ansible-collections/community.general/pull/1882). diff --git a/plugins/modules/net_tools/nmcli.py b/plugins/modules/net_tools/nmcli.py index 6062629482..8ede57d79d 100644 --- a/plugins/modules/net_tools/nmcli.py +++ b/plugins/modules/net_tools/nmcli.py @@ -677,6 +677,10 @@ class Nmcli(object): 'primary': self.primary, 'updelay': self.updelay, }) + elif self.type == 'bond-slave': + options.update({ + 'connection.slave-type': 'bond', + }) elif self.type == 'bridge': options.update({ 'bridge.ageing-time': self.ageingtime,