From 0959b0b96d0754cebfa3fa1cfe9f11538e87b333 Mon Sep 17 00:00:00 2001 From: Jonatan Schlag Date: Wed, 5 Jul 2017 16:19:49 +0200 Subject: [PATCH] zone: Introduce id feature When we write a config for the frist time a unique id is generated and appended to the filename. So it is possible to identify a config clearly. The variable config is rename to hook because this function takes now the name of the hook and the id. The name of the config is no more suitable. If no id is passed we generate one. This should only happen when we write the file for the first time. Fixes: #11405 Signed-off-by: Jonatan Schlag Signed-off-by: Michael Tremer --- src/functions/functions.zone | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/functions/functions.zone b/src/functions/functions.zone index 90d7e115..441bf5f8 100644 --- a/src/functions/functions.zone +++ b/src/functions/functions.zone @@ -1216,8 +1216,13 @@ zone_config_settings_write() { assert [ $# -ge 2 ] local zone="${1}" - local config="${2}" - shift 2 + local hook="${2}" + local id=${3} + + if ! isset id; then + id=$(zone_config_get_new_id ${zone}) + log DEBUG "ID for the config is: ${id}" + fi local args if function_exists "hook_check_config_settings"; then @@ -1225,7 +1230,7 @@ zone_config_settings_write() { fi list_append args ${HOOK_CONFIG_SETTINGS} - local path="$(zone_dir "${zone}")/configs/${config}" + local path="$(zone_dir "${zone}")/configs/${hook}.${id}" settings_write "${path}" ${args} } -- 2.47.3