c2f1e0
From aa561847a82c2446ead5e41742f453629f112b63 Mon Sep 17 00:00:00 2001
c2f1e0
From: Beniamino Galvani <bgalvani@redhat.com>
c2f1e0
Date: Wed, 4 Aug 2021 09:37:31 +0200
c2f1e0
Subject: [PATCH] fix(cms): reload NetworkManager connections
c2f1e0
c2f1e0
When NetworkManager is running as systemd service, it's not enough to write
c2f1e0
connection files; the module should also tell NetworkManager to reload the
c2f1e0
connections from disk so that any new connection can be auto-activated.
c2f1e0
c2f1e0
https://bugzilla.redhat.com/show_bug.cgi?id=1975929
c2f1e0
(cherry picked from commit 07977ee5c5294a5d30c1f33f292a0b31303750fb)
c2f1e0
c2f1e0
Resolves: #1975929
c2f1e0
---
c2f1e0
 modules.d/35network-manager/nm-lib.sh | 4 ++++
c2f1e0
 modules.d/80cms/cmsifup.sh            | 1 +
c2f1e0
 2 files changed, 5 insertions(+)
c2f1e0
c2f1e0
diff --git a/modules.d/35network-manager/nm-lib.sh b/modules.d/35network-manager/nm-lib.sh
c2f1e0
index 2d27e079..1f749587 100644
c2f1e0
--- a/modules.d/35network-manager/nm-lib.sh
c2f1e0
+++ b/modules.d/35network-manager/nm-lib.sh
c2f1e0
@@ -28,3 +28,7 @@ nm_generate_connections() {
c2f1e0
         done
c2f1e0
     fi
c2f1e0
 }
c2f1e0
+
c2f1e0
+nm_reload_connections() {
c2f1e0
+    [ -n "$DRACUT_SYSTEMD" ] && systemctl is-active nm-initrd.service && nmcli connection reload
c2f1e0
+}
c2f1e0
diff --git a/modules.d/80cms/cmsifup.sh b/modules.d/80cms/cmsifup.sh
c2f1e0
index 73d76fbf..285e20d1 100755
c2f1e0
--- a/modules.d/80cms/cmsifup.sh
c2f1e0
+++ b/modules.d/80cms/cmsifup.sh
c2f1e0
@@ -37,6 +37,7 @@ echo "$IFACES" >> /tmp/net.ifaces
c2f1e0
 if [ -x /usr/libexec/nm-initrd-generator ] || [ -x /usr/lib/nm-initrd-generator ]; then
c2f1e0
     type nm_generate_connections > /dev/null 2>&1 || . /lib/nm-lib.sh
c2f1e0
     nm_generate_connections
c2f1e0
+    nm_reload_connections
c2f1e0
 else
c2f1e0
     exec ifup "$DEVICE"
c2f1e0
 fi
c2f1e0