aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2017-11-15 21:42:12 +0100
committerSander Vrijders <sander.vrijders@ugent.be>2017-11-15 21:42:12 +0100
commitea5d4f3be72ff53064e62f10509f2c180a4da39b (patch)
tree661e158e9ce3899134046519d1957b89837fa2db
parent2da15caf24a8b2da70d755e065a5dc3d770c6454 (diff)
downloadrumba-ea5d4f3be72ff53064e62f10509f2c180a4da39b.tar.gz
rumba-ea5d4f3be72ff53064e62f10509f2c180a4da39b.zip
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.
-rw-r--r--rumba/ssh_support.py10
1 files 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])}