-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/4297/
-----------------------------------------------------------

(Updated Dec. 30, 2014, 2:45 p.m.)


Review request for Asterisk Developers.


Changes
-------

Addressed Josh's comments.


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 (updated)
-----

  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

-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev

Reply via email to