]> git.ipfire.org Git - network.git/commitdiff
Print a useful message when bringing up a port that has not been created, yet
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 15 Aug 2017 21:16:47 +0000 (21:16 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 15 Aug 2017 21:16:47 +0000 (21:16 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/functions/functions.ports

index af3f5f06dcb375ceb68e799d8d588ffff3042d1c..f7ea1a0b7ee2485b6c8c0802fbb03ff4c5fc1080 100644 (file)
@@ -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() {