RFC - Feature Template overrides Definition

Andreas Ericsson ae at op5.se
Thu Feb 14 17:28:31 CET 2008


Mark Eisenblaetter wrote:
> On Thu, Feb 14, 2008 at 1:56 PM, Andreas Ericsson <ae at op5.se> wrote:
> 
>> If you could perhaps post your templates for your master and slave and
>> one or two objects that use those template, I'm sure I could explain
>> how you can accomplish what you want, although I'm quite sure already
>> that you'd be off just fine if you left the template-controlled variables
>> out of the objects completely and set them to what they should be in the
>> templates on master and slave.
> 
> 
> Should we do this in this thread or in the initial thread?
> 

In this thread please. The other one is too old for me to fully remember.

> 
>>> I know that the default behavior is the other direction (template ->
>>> service, but service directives are last significant).
>>>
>>> Since Nagios 3.x allows a template addition through the "+" notation my
>>> thoughts goes in this direction.
>>> What would be if you were allowed to inject a special character to your
>>> template to override a service definition (for example).
>>>
>>> With attached patch I got exactly this behavior.
>>>
>> I failed to see the point of your patch after having scrolled past
>> 4 pages of function-renaming diff data. I *do* know that it doesn't
>> even compile with the attached patch. Since it doesn't compile, I'm
>> thinking you can't have tested this very well at all, and what you've
>> actually got running is something else, which you're not at all sure
>> works as per the current spec at all.
>>
> 
> Ok i will look at this. And will do more testing befor submitting the new
> version.
> 
> one question is it better to patch against the last release or the last cvs
> checkout.
> I used the last checkout.
> 

Latest checkout pretty much always.

> 
> 
>> It doesn't compile because you have renamed
>> xodtemplate_clean_additive_string() to xodtemplate_clean_strings() and
>> then call it as xodtemplate_clean_string(). That change is just plain
>> noise and should never have made it into the diff. If you want me to
>> review it, resend with a minimal set of changes so I can see where the
>> logic happens without having to wade through page after page of nonsense.
> 
> 
> there are both funktions in xodtemplate.c and i can't find one wrong
> renaming.
> 

"both" is not applicable in this case, as there are 3 function names in use.
xodtemplate_clean_additive_string()
xodtemplate_clean_strings()
xodtemplate_clean_string()

It used to be the first, you renamed it to the second and you're calling it
as the third.

> I don't want to produce double code so i used addaptive funktions to provide
> the Cleaning in my case.
> in line  98 - 99 you can see that i added my char (=) for cleanup in the
> xodtemplate_clean_additive_string funktion and added the handling of the
> check_command (Host Line 199 service 214) in the
> xodtemplate_clean_additive_strings funktions.
> 
> In this case i tought it would be better to rename the funktion because they
> are not handling  addaptive-only anymore.
> 
> So what the "best" way to do in this case?
> 1. Double the xodtemplate_clean_additive_string and
> xodtemplate_clean_additive_strings
> 2. Use the both funktions an rename them
> 3. Use both funktions and don't touch the name
> 

Pick one name and then use that everywhere. You picked one and used another,
which doesn't work. It's like declaring a variable named "foo" and then
trying to get the value of it by saying "bar". It doesn't work.

Besides, it looked to me as if you were using your function wherever
xodtemplate_clean_additive_string() was used earlier, which should mean
they're interchangeable whenever there is no '=', correct?

> 
> 
>> I'm not saying I'm against the idea, but if you want your patch accepted
>> you need to put in at least a little effort.
>>
>> That's why i start to write the patch but it's my first C++ patch and my
> programming skills are not the best.
> 

Well, we all have to start somewhere. Although, for the record, Nagios is
written in C, not C++ :P

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/




More information about the Developers mailing list