about below case that I'm "fully" on it (I am already deep in it so don't do anything on this specific case ;))  : 

""" parse(and after parse the "creation of the hosts list") problem of a "hostgroup_name" possible attribute of a service definition """ :

does someone know if there exist somewhere a definition of the possible syntax for the expression value that can be set for this attribute ?

more particularly about the "!" special char:

i think (well I think it'd be good like that) that it should, syntactically, mean exactly something like : 
not the members of :
        the following group name (like " !  groupX")  (quite trivial case)
   or the following (sub-)expression eventually, like "! (groupA & groupB)"    ( == "not the members that are in both groups").

but in the current code it's implemented like :  """ all_hosts but not the members of the following subexpression """ :

        # ! (not) should be changed as "ALL-" (all but not...)
        if '!' in expr:
            ALLELEMENTS = self.get_all_host_names_set(hosts)
            # print "Changing ! by ALLELEMENTS- in ", expr
            expr = expr.replace('!', 'ALLELEMENTS-')
            hg_dict_mapping["ALLELEMENTS"] = ALLELEMENTS

shouldn't the "ALLELEMENTS" be in fact "all elements referenced by the current expression".

Like if we have a hostgroup_name like this :

hostgroup_name     group1 , group2 , ! group3

 group1 = host1, host2, host3   
 group2 = host2, host3, host4
 group3 = host2, host3

but if in the config there is more hosts defined (like "host5, ...") then, as the code is actually, Houston we have a problem no, or am I missing something ??

personally I think this specific expression should result in the addition of the "host1" and "host4" hosts both (no more no less)  to the corresponding service..

wdyt already of this ?

more over, what about handling  the new case:

hostgroup_name       expr1 ! expr2 

where expr1 and expr2 would be 2 valid hostgroup_name expression, then the result of " expr1 ! expr 2"  would be : the hosts that are only in expr1 (so the members of the expr2 are removed from those of expr1).

voilà that's my only 2 questions because the others operators are straightforward  ("*" and "&"  and "|"  (that's in fact quite useless because it does the same than "," imho).  (and there miss "^" that could also be very easily added/handled).



---------- Forwarded message ----------
From: shinken <>
Date: 2011/5/1
Subject: Re: [shinken] #248: Parser bug

#248: Parser bug
 Reporter:  net-spider                |       Owner:  leblutch
    Type:  defect                    |      Status:  accepted
 Priority:  major                     |   Milestone:
Component:  Arbiter                   |     Version:  0.5 (Eruptive Earthworm)
 Keywords:  parser hostgroup service  |

Comment(by leblutch):


 ok I've a fix that solve this specific bug but the problem is that I've
 seen others bugs with the parsing of the hostgroup_name possible attribute
 of a service/host definition.

 Unfortunately these others bugs basically require a complete rewrite of
 the functions doing this parsing job (when using complex hostgroup_name
 expression).. I'm nearly done with it but not yet totally ;)

 So in the meantime I'm already going to push the fix for this
 case&substring problem within the hostgroups that can be put in
 hostgroup_name directive.