]> git.ipfire.org Git - people/ms/network.git/commitdiff
Align zone create/remove actions to ports (new/destroy)
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 25 Dec 2014 16:39:29 +0000 (16:39 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 25 Dec 2014 16:39:29 +0000 (16:39 +0000)
man/network-zone-6rd.xml
man/network-zone-6to4-tunnel.xml
man/network-zone-aiccu.xml
man/network-zone-bridge.xml
man/network-zone-pppoe.xml
man/network-zone-pptp.xml
man/network-zone.xml
src/functions/functions.hook
src/functions/functions.zone
src/header-zone
src/network

index 3dddc34cb8f86205421beb28d1d146a3100e7064..ccf5fd8f4219b0005c8a79dbdd4cd175c3d82104 100644 (file)
@@ -29,7 +29,7 @@
 
        <refsynopsisdiv>
                <cmdsynopsis>
-                       <command>network zone create <replaceable>ZONE</replaceable> 6rd ...</command>
+                       <command>network zone new <replaceable>ZONE</replaceable> 6rd ...</command>
                </cmdsynopsis>
 
                <cmdsynopsis>
index 425d5c3236994aea5903cf461b3ba04aae5e50ac..8126e821afa4492241a4e95f349a3fc93774f338 100644 (file)
@@ -29,7 +29,7 @@
 
        <refsynopsisdiv>
                <cmdsynopsis>
-                       <command>network zone create <replaceable>ZONE</replaceable> 6to4-tunnel ...</command>
+                       <command>network zone new <replaceable>ZONE</replaceable> 6to4-tunnel ...</command>
                </cmdsynopsis>
 
                <cmdsynopsis>
index c046c0cb252ed117aed8a2a82981449d9e6e9fa3..ecd3db76c42703f72e1125f3b16fab2a9d679383 100644 (file)
@@ -29,7 +29,7 @@
 
        <refsynopsisdiv>
                <cmdsynopsis>
-                       <command>network zone create <replaceable>ZONE</replaceable> aiccu ...</command>
+                       <command>network zone new <replaceable>ZONE</replaceable> aiccu ...</command>
                </cmdsynopsis>
 
                <cmdsynopsis>
index 4a121fa39af29d9a9d57bcc4b2c1d57d57286a34..efa8d11daee549036838b3436965ffd147320d52 100644 (file)
@@ -29,7 +29,7 @@
 
        <refsynopsisdiv>
                <cmdsynopsis>
-                       <command>network zone create <replaceable>ZONE</replaceable> bridge ...</command>
+                       <command>network zone new <replaceable>ZONE</replaceable> bridge ...</command>
                </cmdsynopsis>
 
                <cmdsynopsis>
index ede9375c646b6e06ed8befc4ec77d5b27d5b18a4..abfb84bf358d460bfa5941879ff25c73e007d0fc 100644 (file)
@@ -29,7 +29,7 @@
 
        <refsynopsisdiv>
                <cmdsynopsis>
-                       <command>network zone create <replaceable>ZONE</replaceable> pppoe ...</command>
+                       <command>network zone new <replaceable>ZONE</replaceable> pppoe ...</command>
                </cmdsynopsis>
        </refsynopsisdiv>
 
index 278816e658fe0f7bdb7659b2876a7e1e000db3d2..3ef077d180d0614f6303dcf29719796fab3c2d50 100644 (file)
@@ -29,7 +29,7 @@
 
        <refsynopsisdiv>
                <cmdsynopsis>
-                       <command>network zone create <replaceable>ZONE</replaceable> pptp ...</command>
+                       <command>network zone new <replaceable>ZONE</replaceable> pptp ...</command>
                </cmdsynopsis>
        </refsynopsisdiv>
 
index 182b95fb4d372e1a8b4140d877713954c33bb8ab..52e3d77f883ca11edaa69d7c4ca9525f5f9345c9 100644 (file)
@@ -29,7 +29,7 @@
 
        <refsynopsisdiv>
                <cmdsynopsis>
-                       <command>network zone <arg choice="plain">[create|remove]</arg> <replaceable>ZONE</replaceable> ...</command>
+                       <command>network zone <arg choice="plain">[new|destroy]</arg> <replaceable>ZONE</replaceable> ...</command>
                </cmdsynopsis>
 
                <cmdsynopsis>
@@ -65,7 +65,7 @@
                <variablelist>
                        <varlistentry>
                                <term>
-                                       <command>create <replaceable>ZONE</replaceable> <replaceable>HOOK</replaceable> <arg choice="opt" rep="repeat">OPTIONS</arg></command>
+                                       <command>new <replaceable>ZONE</replaceable> <replaceable>HOOK</replaceable> <arg choice="opt" rep="repeat">OPTIONS</arg></command>
                                </term>
 
                                <listitem>
 
                        <varlistentry>
                                <term>
-                                       <command>remove <replaceable>ZONE</replaceable></command>
+                                       <command>destroy <replaceable>ZONE</replaceable></command>
                                </term>
 
                                <listitem>
                                        <para>
-                                               A zone can be simple removed with this command.
+                                               A zone can be destroyed with this command.
                                        </para>
                                        <para>
                                                There are two possible ways to remove a zone. The case
index 8146277bbc169f3a8f6c12f4a7118a3de98d150f..27f4389a5f45c783a096994888e78e3cddd11ef7 100644 (file)
@@ -25,8 +25,8 @@ HOOK_COMMANDS_CONFIG="${HOOK_COMMANDS_CONFIG} hook_up"
 HOOK_COMMANDS_PORT="hook_new hook_edit hook_create hook_remove hook_up hook_down \
        hook_hotplug hook_hotplug_rename hook_info hook_status"
 
-HOOK_COMMANDS_ZONE="hook_add hook_create hook_discover hook_down hook_edit hook_help \
-       hook_info hook_remove hook_status hook_up hook_hotplug \
+HOOK_COMMANDS_ZONE="hook_add hook_new hook_discover hook_down hook_edit hook_help \
+       hook_info hook_destroy hook_status hook_up hook_hotplug \
        \
        hook_config_create hook_config_edit hook_config_remove hook_config_show \
        \
index bf156dc9c7d6696e2c8086e7029928c54e89b701..b10ea7b8e8a10e66e6eb8690fe54db63cbbb12b0 100644 (file)
@@ -213,7 +213,7 @@ function zone_cmd() {
        hook_exec zone "${hook}" "${cmd}" "${zone}" $@
 }
 
-function zone_create() {
+function zone_new() {
        local zone=${1}
        local hook=${2}
        shift 2
@@ -238,13 +238,13 @@ function zone_create() {
        # Create directories for configs and ports
        mkdir -p $(zone_dir ${zone})/{configs,ports}
 
-       hook_zone_exec ${hook} create ${zone} $@
+       hook_zone_exec "${hook}" "new" "${zone}" $@
        local ret=$?
 
-       # Maybe the zone create hook did not exit correctly.
+       # Maybe the zone new hook did not exit correctly.
        # If this is the case we remove the created zone immediately.
        if [ "${ret}" = "${EXIT_ERROR}" ]; then
-               zone_remove_now ${zone}
+               zone_destroy_now "${zone}"
                return ${EXIT_ERROR}
        fi
 
@@ -262,7 +262,7 @@ function zone_edit() {
        fi
 
        # Check if the zone is tagged for removal.
-       if zone_has_remove_tag ${zone}; then
+       if zone_has_destroy_tag ${zone}; then
                error "You cannot edit a zone that is tagged for removal."
                return ${EXIT_ERROR}
        fi
@@ -282,39 +282,39 @@ function zone_edit() {
 }
 
 
-function zone_remove() {
-       local zone=${1}
-       assert zone_exists ${zone}
+function zone_destroy() {
+       local zone="${1}"
+       assert zone_exists "${zone}"
 
        # Make the zone for removal.
-       touch $(zone_dir ${zone})/.remove
+       touch "$(zone_dir "${zone}")/.destroy"
 
        log INFO "Zone '${zone}' has been tagged for removal."
 }
 
-function zone_has_remove_tag() {
-       local zone=${1}
-       assert zone_exists ${zone}
+function zone_has_destroy_tag() {
+       local zone="${1}"
+       assert zone_exists "${zone}"
 
-       [ -e "$(zone_dir ${zone})/.remove" ]
+       [ -e "$(zone_dir "${zone}")/.destroy" ]
 }
 
 # This function will remove the given zone
-# RIGHT NOW. Use zone_remove to remove it
+# RIGHT NOW. Use zone_destroy to remove it
 # at the next status change.
-function zone_remove_now() {
-       local zone=${1}
-       assert zone_exists ${zone}
+function zone_destroy_now() {
+       local zone="${1}"
+       assert zone_exists "${zone}"
 
        log INFO "Removing zone '${zone}' right now."
 
        # Force the zone down.
-       zone_is_up ${zone} && zone_set_down ${zone}
+       zone_is_up "${zone}" && zone_set_down "${zone}"
 
        # Disable zone.
        zone_disable "${zone}"
 
-       rm -rf $(zone_dir ${zone})
+       rm -rf "$(zone_dir "${zone}")"
 }
 
 function zone_up() {
@@ -377,8 +377,8 @@ function zone_down() {
        zone_db ${zone} stopped
 
        # Remove the zone, if it has got a remove tag.
-       if zone_has_remove_tag ${zone}; then
-               zone_remove_now ${zone}
+       if zone_has_destroy_tag "${zone}"; then
+               zone_destroy_now "${zone}"
        fi
 }
 
index 996d0ac9f852e243f9f1108111b4d9ae24c20100..a9e1ebef226a41761b706963be1795bf6366d02b 100644 (file)
@@ -29,7 +29,7 @@ function hook_hotplug() {
        exit ${EXIT_NOT_HANDLED}
 }
 
-function hook_create() {
+function hook_new() {
        local zone="${1}"
        assert isset zone
        shift
index 81bb3bb540b69354ac6d19893f084afee26e8575..27f16c67d12e72ce513fcde1e6d0cc5041a78f20 100644 (file)
@@ -540,11 +540,11 @@ function cli_zone() {
                shift
 
                case "${action}" in
-                       create)
-                               zone_${action} $@
+                       new)
+                               zone_new $@
                                ;;
-                       remove)
-                               cli_zone_remove $@
+                       destroy)
+                               cli_zone_destroy $@
                                ;;
                        list-hooks)
                                cli_list_hooks zone $@
@@ -565,21 +565,21 @@ function cli_zone() {
 # Removes a zone either immediately, if it is currently down,
 # or adds a tag that the removal will be done when the zone
 # is brought down the next time.
-function cli_zone_remove() {
+function cli_zone_destroy() {
        if cli_help_requested $@; then
                cli_show_man network-zone
                exit ${EXIT_OK}
        fi
 
-       local zone=${1}
-       assert zone_exists ${zone}
+       local zone="${1}"
+       assert zone_exists "${zone}"
 
        if zone_is_up ${zone}; then
                echo "Zone '${zone}' is up and will be removed when it goes down the next time."
-               zone_remove ${zone}
+               zone_destroy "${zone}"
        else
                echo "Removing zone '${zone}' now..."
-               zone_remove_now ${zone}
+               zone_destroy_now "${zone}"
        fi
 
        exit ${EXIT_OK}
@@ -1040,7 +1040,7 @@ function cli_reset() {
 
        local zone
        for zone in $(zones_get --all); do
-               zone_remove ${zone}
+               zone_destroy_now "${zone}"
        done
 
        local port