From 27fff860b6df72598438ea762cc6593268fa9709 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 10 Aug 2017 23:23:03 +0200 Subject: [PATCH] port: Allow destroying ports that are detached Signed-off-by: Michael Tremer --- src/functions/functions.ports | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/functions/functions.ports b/src/functions/functions.ports index fcb92066..82f9cde2 100644 --- a/src/functions/functions.ports +++ b/src/functions/functions.ports @@ -183,8 +183,10 @@ port_destroy() { local attached_zone=$(port_is_attached ${port}) if [ -n "${attached_zone}" ]; then - error_log "Cannot destroy port '${port}' which is attached to zone '${attached_zone}'." - ok=${EXIT_ERROR} + if ! zone_port_detach "${attached_zone}" "${port}"; then + error "Could not remove port ${port} from zone ${zone}" + return ${EXIT_ERROR} + fi fi # Check if the port is linked to any other port and don't allow the user -- 2.39.2