From ea5d4f3be72ff53064e62f10509f2c180a4da39b Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Wed, 15 Nov 2017 21:42:12 +0100 Subject: ssh_support: Fix predictable interface names The previous fix for predictable interface names was not always working. This commit creates symlinks to /dev/null/ to avoid renaming of the interfaces. --- rumba/ssh_support.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/rumba/ssh_support.py b/rumba/ssh_support.py index 3103811..2bc761b 100644 --- a/rumba/ssh_support.py +++ b/rumba/ssh_support.py @@ -324,14 +324,10 @@ def setup_vlans(testbed, node, vlans): return s else: def sudo(s): - return 'sudo ' + s + return "sudo sh -c '" + s + "'" - cmds = ["if [ -d /etc/udev/rules.d ] && " - "[ \"$(ls -A /etc/udev/rules.d)\" ]; " - "then sudo rm /etc/udev/rules.d/*; " - "type systemctl > /dev/null 2>&1; " - "if [ $? -eq 0 ]; then sudo systemctl " - "restart systemd-networkd; fi; fi"] + cmds = [sudo("for file in $(ls -d /etc/udev/rules.d/*); do rm $file; " + + "ln -s /dev/null $file; done")] for item in vlans: args = {'ifname': str(item[0]), 'vlan': str(item[1])} -- cgit v1.2.3