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 jonatan.schlag@ipfire.org --- 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 90d7e11..441bf5f 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} }