From: Michael Tremer Date: Thu, 10 Aug 2017 21:23:03 +0000 (+0200) Subject: port: Allow destroying ports that are detached X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=27fff860b6df72598438ea762cc6593268fa9709;p=people%2Fjschlag%2Fnetwork.git port: Allow destroying ports that are detached Signed-off-by: Michael Tremer --- diff --git a/src/functions/functions.ports b/src/functions/functions.ports index fcb9206..82f9cde 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