aboutsummaryrefslogtreecommitdiff
path: root/rumba/testbeds
diff options
context:
space:
mode:
authorMarco Capitani <m.capitani@nextworks.it>2018-02-12 16:53:28 +0100
committerSander Vrijders <sander.vrijders@ugent.be>2018-02-12 18:03:33 +0100
commit25bd117a9ce2bb4365743848d3c8742e3deb8afa (patch)
tree0b5b3eace59d0dfb0e9d7938c25945a27fa830fb /rumba/testbeds
parent4066c5f649f6837fdf9e8d3c249af0dfab69e36a (diff)
downloadrumba-25bd117a9ce2bb4365743848d3c8742e3deb8afa.tar.gz
rumba-25bd117a9ce2bb4365743848d3c8742e3deb8afa.zip
jfed: simplify mac2ifname to avoid LOCALE problems
Diffstat (limited to 'rumba/testbeds')
-rw-r--r--rumba/testbeds/jfed.py21
1 files changed, 8 insertions, 13 deletions
diff --git a/rumba/testbeds/jfed.py b/rumba/testbeds/jfed.py
index 5fdde99..391ba10 100644
--- a/rumba/testbeds/jfed.py
+++ b/rumba/testbeds/jfed.py
@@ -264,16 +264,6 @@ class Testbed(mod.Testbed):
node_n.ssh_config.hostname = l_node.getAttribute("hostname")
- ssh_support.execute_command(
- self,
- node_n.ssh_config,
- "sudo locale-gen en_US.UTF-8 || true")
-
- ssh_support.execute_command(
- self,
- node_n.ssh_config,
- "sudo touch /var/lib/cloud/instance/locale-check.skip || true")
-
for intf in intfs:
aux_mac_address = intf.getAttribute("mac_address")
@@ -285,9 +275,14 @@ class Testbed(mod.Testbed):
mac = aux_mac_address
command = (
- 'echo "mac=\\"\$1\\"; cd / && ./sbin/ifconfig -a | '
- 'awk \'/^[a-z]/ { if ( \\"\'\\"\$mac\\"\'\\" == \$5 )'
- ' print \$1}\'" > mac2ifname.sh')
+ "echo '#!/usr/bin/env bash' > mac2ifname.sh; "
+ r"echo 'for i in $(ls /sys/class/net/); do "
+ r'addr="$(cat /sys/class/net/$i/address)"; '
+ r'if [[ "$addr" == "$1" ]]; then '
+ r'echo "$i"; '
+ r'fi; '
+ r"done' >> mac2ifname.sh"
+ )
ssh_support.execute_command(self, node_n.ssh_config, command)
ssh_support.execute_command(