[asterisk-dev] [Code Review] 4297: config: Add option to NOT preserve the effective context when changing a template.
George Joseph
reviewboard at asterisk.org
Tue Dec 30 15:28:09 CST 2014
> On Dec. 30, 2014, 8:20 a.m., Joshua Colp wrote:
> > branches/13/include/asterisk/config.h, line 50
> > <https://reviewboard.asterisk.org/r/4297/diff/2/?file=70040#file70040line50>
> >
> > This is picky but we don't use the word "quirk" anywhere else. We generally just refer to them as behavior flags, or flags.
Sorry, I was deep in the linux kernel that day and had driver quirks on the brain.
- George
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/4297/#review14049
-----------------------------------------------------------
On Dec. 28, 2014, 6:22 p.m., George Joseph wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/4297/
> -----------------------------------------------------------
>
> (Updated Dec. 28, 2014, 6:22 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 430144
> branches/13/main/config.c 430144
> branches/13/include/asterisk/config.h 430144
>
> 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/20141230/d5b596bd/attachment.html>
More information about the asterisk-dev
mailing list