diff options
author | Nik Lutz <nik@netstyle.ch> | 2016-05-12 15:37:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@open-infrastructure.net> | 2016-05-18 18:26:06 +0000 |
commit | 11c81a274b1a9de91f44f88b625a718adad771e0 (patch) | |
tree | 19fb1efa338bc37d8c58aa384a6c44b6f366e107 /lib/container/stop | |
parent | Using systemd-nspawn '--network-veth-extra=' instead of '--network-veth' (pre... (diff) | |
download | compute-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-x | lib/container/stop | 22 |
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 |