From 25bd117a9ce2bb4365743848d3c8742e3deb8afa Mon Sep 17 00:00:00 2001 From: Marco Capitani Date: Mon, 12 Feb 2018 16:53:28 +0100 Subject: jfed: simplify mac2ifname to avoid LOCALE problems --- rumba/testbeds/jfed.py | 21 ++++++++------------- 1 file 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( -- cgit v1.2.3