From: Michael Tremer Date: Sat, 12 Mar 2011 11:07:32 +0000 (+0000) Subject: Fix weird device CLI command. X-Git-Tag: 001~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a4ccede806c4888a95a3628d07c0989913ed477;p=network.git Fix weird device CLI command. For now, discover and show are supported. --- diff --git a/functions.cli b/functions.cli index aa0bddf6..a2ceb99e 100644 --- a/functions.cli +++ b/functions.cli @@ -33,44 +33,32 @@ function cli_config() { } function cli_device() { - if device_config_exists ${1}; then - local device=${1} - local action=${2} - shift 2 + local device=${1} + local action=${2} + shift 2 - case "${action}" in - down|up) - device_${action} ${device} $@ - ;; - esac - else - local action=${1} - shift + assert device_exists ${device} - case "${action}" in - create) - device_${action} $@ - ;; + if zone_exists ${device} || port_exists ${device}; then + error "The device '${device}' has already been configured." + error "You cannot do a device action." + return ${EXIT_ERROR} + fi - discover) - echo "# XXX need to implement --raw here" - local device - for device in ${devices}; do - cli_device_discover ${device} $@ - done - ;; + case "${action}" in + discover) + echo "# XXX need to implement --raw here" + cli_device_discover ${device} $@ + ;; - show|"") - local device - for device in $(device_get $@); do - device_print ${device} - done - ;; - *) - cli_usage device - ;; - esac - fi + show|"") + # XXX device_show needs to be implemented + device_show ${device} + ;; + *) + cli_usage device + ;; + esac } function cli_device_discover() {