From 11c81a274b1a9de91f44f88b625a718adad771e0 Mon Sep 17 00:00:00 2001 From: Nik Lutz Date: Thu, 12 May 2016 17:37:50 +0200 Subject: Removing network interface configuration in /etc/network/interfaces.d after container stop. Signed-off-by: Daniel Baumann --- lib/container/stop | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'lib') diff --git a/lib/container/stop b/lib/container/stop index cd3de10..18d154c 100755 --- a/lib/container/stop +++ b/lib/container/stop @@ -20,6 +20,7 @@ set -e COMMAND="$(basename ${0})" +CONFIG="/etc/container-tools/config" MACHINES="/var/lib/machines" Parameters () @@ -105,3 +106,24 @@ esac # Run machinectl ${MODE} ${NAME} + +# Removing network configuration +NETWORK_VETH_EXTRA_CONF="$(awk -F= '/^network-veth-extra=/ { print $2 }' ${CONFIG}/${NAME}.conf)" + +case "${NETWORK_VETH_EXTRA_CONF}" in + "") + ;; + + *) + for VETH in ${NETWORK_VETH_EXTRA_CONF} + do + INTERFACE="$(echo ${VETH} | awk -F: '{ print $1 }')" + FILE="/etc/network/interfaces.d/${INTERFACE}" + + if [ -f "${FILE}"] + then + rm -f "${FILE}" + fi + done + ;; +esac -- cgit v1.2.3