two-images: rocky10, profils NM de cloud-init nommés par interface #1
All checks were successful
Tests / check (push) Successful in 38s

cloud-init 24.4 nomme le profil NetworkManager d'après la clé du
network-config (eth0) et le cherche d'après l'interface (ens3) : la
2e interface n'est jamais activée, et au redémarrage le profil de
repli porte le même UUID, nmcli up échoue (degraded done).

Correctif dans l'image : fichier nommé par interface, contrôlé par
check.sh. test.sh sert un network-config au format de two (2 NIC
décrites, 1 sans entrée) et vérifie cloud-init après redémarrage.

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-11-06 00:32:01 +01:00
commit 344363d49c
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
5 changed files with 52 additions and 13 deletions

View file

@ -53,6 +53,28 @@ for unit in rpcbind.service rpcbind.socket; do
fi
done
CLOUDINIT=$(chroot /mnt python3 -c 'import cloudinit, os; print(os.path.dirname(cloudinit.__file__))')
[ -n "${CLOUDINIT}" ] || die "module cloudinit introuvable dans la cible"
patch -d "/mnt${CLOUDINIT}" -p1 --forward --fuzz=0 --no-backup-if-mismatch <<'EOF'
--- a/net/network_manager.py
+++ b/net/network_manager.py
@@ -594,10 +594,11 @@
conn.render_interface(iface, network_state, self)
# And finally write the files
- for con_id, conn in self.connections.items():
+ for iface in network_state.iter_interfaces():
+ conn = self.connections[iface.get("config_id") or iface["name"]]
if not conn.valid():
continue
- name = nm_conn_filename(con_id, target)
+ name = nm_conn_filename(iface["name"], target)
util.write_file(name, conn.dump(), 0o600)
# Select EUI64 to be used by default by NM for creating the address
EOF
chroot /mnt python3 -m py_compile "${CLOUDINIT}/net/network_manager.py"
augtool -r /mnt -s set /files/etc/selinux/config/SELINUX disabled
augtool -r /mnt -s rm /files/etc/chrony.conf/pool