[asterisk-dev] [Code Review] 4297: config: Add option to NOT preserve the effective context when changing a template.
Joshua Colp
reviewboard at asterisk.org
Wed Jan 7 08:43:31 CST 2015
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/4297/#review14100
-----------------------------------------------------------
Ship it!
Ship It!
- Joshua Colp
On Dec. 30, 2014, 9:45 p.m., George Joseph wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/4297/
> -----------------------------------------------------------
>
> (Updated Dec. 30, 2014, 9:45 p.m.)
>
>
> Review request for Asterisk Developers.
>
>
> Repository: Asterisk
>
>
> Description
> -------
>
> 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 quirks, one of which is to preserve the effective context (the current behavior). The original ast_config_text_file_save calls *2 with the preserve quirk. If you want the new behavior, call *2 directly without a quirk.
>
> 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'.
>
>
> Diffs
> -----
>
> branches/13/main/manager.c 430163
> branches/13/main/config.c 430163
> branches/13/include/asterisk/config.h 430163
>
> Diff: https://reviewboard.asterisk.org/r/4297/diff/
>
>
> Testing
> -------
>
> This is tough to test with unit tests but the existing TestSuite manager/config tests check the existing behavior and they still pass. I've also added a new no_preserve_effective_context test to manager/config that tests the new behavior.
>
>
> Thanks,
>
> George Joseph
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20150107/1d8d0b18/attachment.html>
More information about the asterisk-dev
mailing list