summaryrefslogtreecommitdiffstats
path: root/lib/container
diff options
context:
space:
mode:
authorNik Lutz <nik@netstyle.ch>2016-05-12 15:37:50 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2016-05-18 18:26:06 +0000
commit11c81a274b1a9de91f44f88b625a718adad771e0 (patch)
tree19fb1efa338bc37d8c58aa384a6c44b6f366e107 /lib/container
parentUsing systemd-nspawn '--network-veth-extra=' instead of '--network-veth' (pre... (diff)
downloadcompute-tools-11c81a274b1a9de91f44f88b625a718adad771e0.tar.xz
compute-tools-11c81a274b1a9de91f44f88b625a718adad771e0.zip
Removing network interface configuration in /etc/network/interfaces.d after container stop.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to '')
-rwxr-xr-xlib/container/stop22
1 files changed, 22 insertions, 0 deletions
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