From f28e991c0c4e97bbddd6f14ca2f9488cefd34762 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 15 Aug 2017 21:16:47 +0000 Subject: [PATCH] Print a useful message when bringing up a port that has not been created, yet Signed-off-by: Michael Tremer --- src/functions/functions.ports | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/functions/functions.ports b/src/functions/functions.ports index af3f5f06..f7ea1a0b 100644 --- a/src/functions/functions.ports +++ b/src/functions/functions.ports @@ -238,7 +238,17 @@ port_edit() { } port_up() { - port_cmd up $@ + assert [ $# -eq 1 ] + + local port="${1}" + + # Check if the port exists + if ! device_exists "${port}"; then + log ERROR "Could not bring up port ${port} which has not been created" + return ${EXIT_ERROR} + fi + + port_cmd up "${port}" } port_down() { -- 2.47.3