assert isset zone
shift
- if ! hook_parse_cmdline $@; then
+ local ${HOOK_SETTINGS}
+
+ # Import all default variables
+ hook_set_defaults
+
+ if ! hook_parse_cmdline "$@"; then
return ${EXIT_ERROR}
fi
return ${EXIT_ERROR}
fi
- if ! hook_parse_cmdline $@; then
+ if ! hook_parse_cmdline "$@"; then
return ${EXIT_ERROR}
fi
local ret
case "${action}" in
add|create|edit|rem|show)
- hook_port_${action} "${zone}" $@
+ hook_port_${action} "${zone}" "$@"
ret=$?
;;
*)
}
hook_port_create() {
- hook_default_port_create $@
+ hook_default_port_create "$@"
}
hook_default_port_remove() {
}
hook_port_remove() {
- hook_default_port_remove $@
+ hook_default_port_remove "$@"
}
hook_port_up() {
local hook=$(zone_config_get_hook_from_id ${zone} ${id})
assert isset hook
- hook_config_cmd "destroy" "${zone}" "${hook}" "${hook}.${id}" "$@"
+ # First we bring the hook down
+ hook_config_cmd "down" "${zone}" "${hook}" "${hook}.${id}"
+
+ # If a hook_destroy function is implemented in the hook this function will be executed.
+ # If not a empty defined in header-config is executed.
+ if ! hook_config_cmd "destroy" "${zone}" "${hook}" "${hook}.${id}" "$@"; then
+
+ # A better error message should printed inside the hook.
+ # We will not bring the config up because we do not know if it is safe or if some parts are already destroyed.
+ log ERROR "Could not destroy config with the follwoing id: ${id}"
+ return ${EXIT_ERROR}
+ fi
+
+ # Now we delete the config of the zone
+ zone_config_settings_destroy "${zone}" "${hook}.${id}"
}
hook_config_edit() {