From 596a6e51710b71ec8f48322b5e8fb459eec5f66e Mon Sep 17 00:00:00 2001 From: Nik Lutz Date: Wed, 18 May 2016 10:53:02 +0200 Subject: Swaping parsing order of NETWORK_VETH_EXTRA and NETWORK_BRIDGES. Signed-off-by: Daniel Baumann --- lib/container/start | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'lib/container/start') diff --git a/lib/container/start b/lib/container/start index 112ee9b..d0e7e6e 100755 --- a/lib/container/start +++ b/lib/container/start @@ -185,57 +185,57 @@ then MACHINE="--machine=${NAME}" - NETWORK_BRIDGES="$(awk -F= '/^cnt.network-bridge=/ { print $2 }' ${CONFIG}/${NAME}.conf)" + NETWORK_VETH_EXTRA_CONF="$(awk -F= '/^network-veth-extra=/ { print $2 }' ${CONFIG}/${NAME}.conf)" + NETWORK_VETH_EXTRA="" - case "${NETWORK_BRIDGES}" in + case "${NETWORK_VETH_EXTRA_CONF}" in "") ;; *) - for BRIDGE_DEFINITION in ${NETWORK_BRIDGES} + for VETH in ${NETWORK_VETH_EXTRA_CONF} do - INTERFACE="$(echo ${BRIDGE_DEFINITION} | awk -F: '{ print $1 }')" - BRIDGE="$(echo ${BRIDGE_DEFINITION} | awk -F: '{ print $2 }')" - - if [ -n "${BRIDGE}" ] && [ -n "${INTERFACE}" ] - then + NETWORK_VETH_EXTRA="${NETWORK_VETH_EXTRA} --network-veth-extra=${VETH}" + INTERFACE="$(echo ${VETH} | awk -F: '{ print $1 }')" cat > "/etc/network/interfaces.d/${INTERFACE}" << EOF allow-hotplug ${INTERFACE} iface ${INTERFACE} inet manual pre-up ifconfig ${INTERFACE} up - post-up brctl addif ${BRIDGE} ${INTERFACE} - pre-down brctl delif ${BRIDGE} ${INTERFACE} post-down ifconfig ${INTERFACE} down EOF - else - echo "'${BRIDGE_DEFINITION}': no such devices, ignoring" >&2 - fi done ;; esac - NETWORK_VETH_EXTRA_CONF="$(awk -F= '/^network-veth-extra=/ { print $2 }' ${CONFIG}/${NAME}.conf)" - NETWORK_VETH_EXTRA="" + NETWORK_BRIDGES="$(awk -F= '/^cnt.network-bridge=/ { print $2 }' ${CONFIG}/${NAME}.conf)" - case "${NETWORK_VETH_EXTRA_CONF}" in + case "${NETWORK_BRIDGES}" in "") ;; *) - for VETH in ${NETWORK_VETH_EXTRA_CONF} + for BRIDGE_DEFINITION in ${NETWORK_BRIDGES} do - NETWORK_VETH_EXTRA="${NETWORK_VETH_EXTRA} --network-veth-extra=${VETH}" - INTERFACE="$(echo ${VETH} | awk -F: '{ print $1 }')" + INTERFACE="$(echo ${BRIDGE_DEFINITION} | awk -F: '{ print $1 }')" + BRIDGE="$(echo ${BRIDGE_DEFINITION} | awk -F: '{ print $2 }')" + + if [ -n "${BRIDGE}" ] && [ -n "${INTERFACE}" ] + then cat > "/etc/network/interfaces.d/${INTERFACE}" << EOF allow-hotplug ${INTERFACE} iface ${INTERFACE} inet manual pre-up ifconfig ${INTERFACE} up + post-up brctl addif ${BRIDGE} ${INTERFACE} + pre-down brctl delif ${BRIDGE} ${INTERFACE} post-down ifconfig ${INTERFACE} down EOF + else + echo "Warning bridge definition '${BRIDGE_DEFINITION}' not recognized (expected :): Ignoring" + fi done ;; esac -- cgit v1.2.3