From ab5edf530bc99b109630ba0170227aa9960f681c Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 10 Aug 2017 23:16:20 +0200 Subject: [PATCH] ports: Cannot delete a port that does not exist Signed-off-by: Michael Tremer --- src/functions/functions.ports | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/functions/functions.ports b/src/functions/functions.ports index 3f873c99..fcb92066 100644 --- a/src/functions/functions.ports +++ b/src/functions/functions.ports @@ -170,10 +170,13 @@ port_new() { port_destroy() { local port=${1} - assert isset port - port_exists ${port} || return ${EXIT_OK} + # Cannot delete a port that does not exist + if ! port_exists ${port}; then + error "No such port: ${port}" + return ${EXIT_ERROR} + fi # Check if the port is attached to any zone and don't delete it. local ok=${EXIT_OK} -- 2.47.3