[asterisk-dev] [Code Review] Add #includeif statement

Tilghman Lesher tilghman at meg.abyt.es
Wed Oct 5 09:50:53 CDT 2011


On Wed, Oct 5, 2011 at 9:47 AM, Paul Belanger <pabelanger at digium.com> wrote:
> On 11-10-05 10:41 AM, Tilghman Lesher wrote:
>>
>> On Wed, Oct 5, 2011 at 9:32 AM, Paul Belanger<pabelanger at digium.com>
>>  wrote:
>>>
>>> On 11-10-05 10:21 AM, Jason Parker wrote:
>>>>
>>>> On 10/04/2011 07:47 PM, Matt Riddell wrote:
>>>>>
>>>>> What was the original reason that #include started blocking the loading
>>>>> of
>>>>> modules when the included file was missing?  I've always hated that.
>>>>>
>>>>
>>>> Take the following config setup as an example.
>>>>
>>>> sip.conf:
>>>> #include mypeer.conf
>>>> #include yourpeer.conf
>>>>
>>>> mypeer.conf:
>>>> [mypeer]
>>>> type=peer
>>>> host=10.0.0.2
>>>> #include mypeer-secret.conf
>>>>
>>>> yourpeer.conf:
>>>> [yourpeer]
>>>> type=peer
>>>> host=10.0.0.3
>>>> #include yourpeer-secret.conf
>>>>
>>>> myypeer-secret.conf:
>>>> secret=applesauce
>>>>
>>>> yourpeer-secret.conf:
>>>> secret=embiggen
>>>>
>>>>
>>>> The astute may have noticed that there is a typo in the
>>>> mypeer-secret.conf.
>>>> What would happen if we allowed the config parser to continue?  Very bad
>>>> things.
>>>>
>>>> This is just one of several scenarios that I could think of.  It makes a
>>>> lot of
>>>> sense to me that if somebody uses a #include, then they absolutely must
>>>> have
>>>> that file - even if it's empty.
>>>>
>>> Right, and this approach for #include is fine to be honest.  I don't
>>> think I
>>> would suggest changing that functionality.  However, if you rely a lot on
>>> include files for your asterisk setup, something we currently do with the
>>> test-suite, having a lot of empty files lying around clutters up the file
>>> system.
>>>
>>> One of the main reasons #includeif / #sinclude is being suggested is to
>>> help
>>> an administrator, who understands the differences between the two, cut
>>> down
>>> on the amount of files that needs to be managed (even if they are empty).
>>
>> If that's your intent, why not just use the file globbing already in
>> the source, i.e.
>> #include sippeers-*.conf
>>
> I can try again, but I was not able to get this working.  The module would
> still fail to load.

Clearly, if something is broken, instead of fixing it, we should
instead code a whole new feature that accomplishes the same thing.
Right?  :-P



More information about the asterisk-dev mailing list