From 39e6f7a5c45bb40f05d538ee87a25dce9b478dc6 Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Fri, 14 Feb 2014 14:41:28 +1300 Subject: [PATCH] Revert "Support adding DHCP interfaces one at a time. " This reverts commit a1b469b10b90b594c256295c140e837726058b87. This broke testenv deployments - it does not yet work on Ubuntu. Change-Id: I0f74abc6b99da4b8cabca8ed673c606bae7de0e1 --- .../install.d/dhcp-all-interfaces.sh | 25 +++++-------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces.sh b/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces.sh index 60b3179e..7d53352d 100755 --- a/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces.sh +++ b/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces.sh @@ -1,10 +1,7 @@ #!/bin/bash -INTERFACE=$1 #optional, if not specified configure all available interfaces ENI_FILE="/etc/network/interfaces" -PATH=/bin:/sbin:$PATH - if [ -d "/etc/network" ]; then CONF_TYPE="eni" elif [ -d "/etc/sysconfig/network-scripts/" ]; then @@ -66,17 +63,16 @@ function config_exists() { fi } -function inspect_interface() { - local interface=$1 - local mac_addr_type="$(cat /sys/class/net/${interface}/addr_assign_type)" +for interface in $(ls /sys/class/net | grep -v ^lo$) ; do + MAC_ADDR_TYPE="$(cat /sys/class/net/${interface}/addr_assign_type)" echo -n "Inspecting interface: $interface..." if config_exists $interface; then echo "Has config, skipping." - elif [ "$mac_addr_type" != "0" ]; then + elif [ "$MAC_ADDR_TYPE" != "0" ]; then echo "Device has generated MAC, skipping." - else - ip link set dev $interface up &>/dev/null + else + ip link set dev $interface up >/dev/null 2>&1 HAS_LINK="$(get_if_link $interface)" TRIES=10 @@ -95,13 +91,4 @@ function inspect_interface() { disable_interface "$interface" fi fi - -} - -if [ -n "$INTERFACE" ]; then - inspect_interface $INTERFACE -else - for iface in $(ls /sys/class/net | grep -v ^lo$); do - inspect_interface $iface - done -fi +done