On Tue, Dec 7, 2010 at 9:54 AM, nap <napar...@gmail.com> wrote:
> Hi,
>
> On Mon, Dec 6, 2010 at 9:25 PM, Hartmut Goebel <h.goe...@goebel-consult.de
> > wrote:
>
>> Am 06.12.2010 09:48, schrieb nap:
>>
>> Where the properties dict are used? In fact thay are used nearly every
>> where in the part of code that manage creating the objects, link them and
>> look if they are correct. Then in the runnign part, they are not very useful
>> anymore (unless in the retention part of course).
>>
>> [...]
>>
>> Yes, because a lot of properties look the same after all.
>>
>> So this is a big sign that logic should be encapsulated into some
>> Properties classes instead of been spread all over the source.
>>
> Yes it if was a code, but here it's data, so it's not so direct. It must be
> clear to a dev when he read theses dict that this property got such
> properties. If it's not clear, and he must look to a lot of places, it's not
> a good thing. But with a good comment before the dict, it should be clear
> what are the defaults parameters of the properties classes.
>
Hi,
The result code seems ok (all : you can look at
https://sourceforge.net/apps/trac/shinken/ticket/191). The missing
required=False is not a problem with the default parameter easily visible.
> This change would save a lot of code elsewhere, since many test could be
>> removed and test could be simplified. E.G. item.Item.pythonize() could be as
>> short as:
>>>
>>> def pythonize(self):
>>> for name, prop in self.__class__.properties.items():
>>> try:
>>> old_val = getattr(self, name)
>>> new_val = old_val.pythonize()
>>> #print "Changing", old_val, "to", new_val
>>> setattr(self, name, new_val)
>>> except AttributeError , exp:
>>> #print self.get_name(), ' : ', exp
>>> pass # Will be catched at the is_correct momen
>>>
>>> Not really here, because the old_val is a string here (getattr get the
>> object property, and
>>
>> Sorry, there is an error in this (untested) lines. It should be
>>
>> new_val = prop.pythonize(old_val)
>>
>> If it enhance the readability and is still easy to understand (let say
>> not so hard), it's ok, like Gerhard I'm ok to get this tool :)
>>
>> I'll put it into trak, together with the converted props from config.py
>> and -- if I find time -- a draft properties module.
>>
> Thanks.
>
>>
>> But if it's a 2 days job and it's easy to test, 0.4 can wait some few
>> days. Let look at how it look so.
>>
>> Most time consuming will be to find all places, where the properties dict
>> is used and eliminate it there. But since you know your code better, you
>> should make it within two days :-)
>>
> I'm looking at this. I'll see how much time it ask to code, and to test of
> course.
>
The result code look good, but it's a quite huge patch. It's not just small
utility functions that are touched, but the core functions ones, and some
impacts can be hard to test/identify. I'm not applying this patch for 0.4
because it do not added direct value to users, only for dev (it's a long
term enhancement, not a direct one for users that are waiting for production
launch right now). But it will be a major part of the next version and I'll
work on applying this before the cluster/business correlation I think. So
with our new release out, other dev can add new features again, like the
escalation based on time or downtime for contacts and a moving code won't be
a problem for some weeks :)
I just fixed a bug in the arbiter check code, and so I'm currently updating
the demo vm with our new code, a new Thruk version and an updated NagVis
version too. Then it will be release, and we will be able to look at the
properties shrinking.
The new version will be out this week :)
(now I will have to found a funny dragonfly picture, that will take some
days to find a good one ;) ).
Jean
>
> Jean
>
>>
>> --
>> Schönen Gruß - Regards
>> Hartmut Goebel
>> Dipl.-Informatiker (univ.), CISSP, CSSLP
>>
>> Goebel Consult
>> Spezialist für IT-Sicherheit in komplexen
>> Umgebungenhttp://www.goebel-consult.de
>>
>> Monatliche Kolumne: http://www.cissp-gefluester.de/
>> Goebel Consult mit Mitglied bei http://www.7-it.de
>>
>>
>>
>> ------------------------------------------------------------------------------
>> What happens now with your Lotus Notes apps - do you make another costly
>> upgrade, or settle for being marooned without product support? Time to
>> move
>> off Lotus Notes and onto the cloud with Force.com, apps are easier to
>> build,
>> use, and manage than apps on traditional platforms. Sign up for the Lotus
>> Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
>> _______________________________________________
>> Shinken-devel mailing list
>> Shinken-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/shinken-devel
>>
>>
>
------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
Shinken-devel mailing list
Shinken-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/shinken-devel