From: Jonatan Schlag Date: Wed, 5 Jul 2017 14:19:50 +0000 (+0200) Subject: header-zone: refactor hook_config_destroy X-Git-Tag: 009~189 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6002aef136fd915932c615b09234cac60d59604c;p=network.git header-zone: refactor hook_config_destroy With the new id function this function gets a zone name and a id, but hook_config_cmd needs also the name of the hook. So this function now calls zone_config_get_hook_from_id to get the hook and calls then hook_config_cmd with the correct argument order. Signed-off-by: Jonatan Schlag Signed-off-by: Michael Tremer --- diff --git a/src/header-zone b/src/header-zone index c445d55f..fdd6e510 100644 --- a/src/header-zone +++ b/src/header-zone @@ -206,7 +206,22 @@ hook_config_new() { } hook_config_destroy() { - hook_config_cmd "destroy" "$@" + assert [ $# -eq 2 ] + local zone=${1} + # The id must be the id and not the hid. + local id=${2} + + shift 2 + + # Check if we get a valid id + if ! zone_config_id_is_valid ${zone} ${id}; then + log ERROR "ID: ${id} is not a valid id for zone ${zone}" + fi + + local hook=$(zone_config_get_hook_from_id ${zone} ${id}) + assert isset hook + + hook_config_cmd "destroy" "${zone}" "${hook}" "${hook}.${id}" "$@" } hook_config_edit() {