]> git.ipfire.org Git - thirdparty/asterisk.git/commit
config: Add option to NOT preserve effective context when changing a template
authorGeorge Joseph <george.joseph@fairview5.com>
Wed, 7 Jan 2015 16:55:14 +0000 (16:55 +0000)
committerGeorge Joseph <george.joseph@fairview5.com>
Wed, 7 Jan 2015 16:55:14 +0000 (16:55 +0000)
commit75cd302b0af6a14d8a7b53330049b34e33aece75
treef357336bca27e1228150c307a96b6dd2ae40e0ef
parente17a1a8ba1a250a2a4850af1f451d3f03995cace
config: Add option to NOT preserve effective context when changing a template

Let's say you have a template T with variable VAR1 = ON and you have a
context C(T) that doesn't specify VAR1.  If you read C, the effective value
of VAR1 is ON.  Now you change T VAR1 to OFF and call
ast_config_text_file_save.  The current behavior is that the file gets
re-written with T/VAR1=OFF but C/VAR1=ON is added.  Personally, I think this
is a bug. It's preserving the effective state of C even though I didn't
specify C/VAR1 in th first place.  I believe the behavior should be that if
I didn't specify C/VAR1 originally, then the effective value of C/VAR1 should
continue to follow the inherited state.  Now, if I DID explicitly specify
C/VAR1, the it should be preserved even if the template changes.

Even though I think the existing behavior is a bug, it's been that way forever
so I'm not changing it.  Instead, I've created ast_config_text_file_save2()
that takes a bitmask of flags, one of which is to preserve the effective context
(the current behavior).  The original ast_config_text_file_save calls *2 with
the preserve flag.  If you want the new behavior, call *2 directly without a
flag.

I've also updated Manager UpdateConfig with a new parameter
'PreserveEffectiveContext' whose default is 'yes'.  If you want the new behavior
with UpdateConfig, set 'PreserveEffectiveContext: no'.

Tested-by: George Joseph
Review: https://reviewboard.asterisk.org/r/4297/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@430295 65c4cc65-6c06-0410-ace0-fbb531ad65f3
include/asterisk/config.h
main/config.c
main/manager.c