Perfect, why didn't I think of that - nice and simple. With this and a
more precise (and less readable) regexp, I now have the following:

classes:
   "svxx" expression => classmatch("sv[0-9]{2}"); #sv00, sv01, ..., sv99

Thanks,
Erlend



On 21 April 2010 08:57, Mark Burgess <mark.burg...@iu.hio.no> wrote:
>
> Sorry, I forgot to remove a {
>
> classes:
>    "svxx" expression => classmatch("sv..");
>
> Mark Burgess wrote:
>> Oh, I didn't notice that. But why not simply write
>>
>> classes:
>>    "svxx" expression =>{classmatch("sv..");
>>
>> Erlend Leganger wrote:
>>> I guess it's the and-any construct that looks strange to me, it's like
>>> writing a boolean expression with an "and True" at the end:
>>>
>>> if ($condition && 1){
>>>   &do_something;
>>> }
>>>
>>> But if this is the best way, I won't complain.
>>>
>>> - Erlend
>>>
>>> On 21 April 2010 07:19, Mark <m...@iu.hio.no> wrote:
>>>> Why do you say this is convoluted? I think it looks just fine
>>>>
>>>>
>>>> Mark
>>>>
>>>>
>>>> On 21 Apr 2010, at 07:07, Erlend Leganger <erlend.legan...@gmail.com> 
>>>> wrote:
>>>>
>>>>> I have some servers named sv01, sv02, sv03, ... which I need a class
>>>>> for in cf3 community 3.0.2. I have come up with this:
>>>>>
>>>>> classes:
>>>>>   "svxx" and =>{classmatch("sv.."),any};
>>>>>
>>>>> so that I later can do for example:
>>>>>
>>>>> files:
>>>>>   svxx::
>>>>>      "/etc/passwd"
>>>>>         handle=>"update_passwd",
>>>>>         ...
>>>>>
>>>>> I don't remember how I came up with this construct (probably by trial
>>>>> and error until it clicked) - it looks kind of convoluted.
>>>>>
>>>>> What is the best way to do this?
>>>>>
>>>>> - Erlend
>>>>> _______________________________________________
>>>>> Help-cfengine mailing list
>>>>> Help-cfengine@cfengine.org
>>>>> https://cfengine.org/mailman/listinfo/help-cfengine
>>> _______________________________________________
>>> Help-cfengine mailing list
>>> Help-cfengine@cfengine.org
>>> https://cfengine.org/mailman/listinfo/help-cfengine
>>
>
> --
> Mark Burgess
>
> -------------------------------------------------
> Professor of Network and System Administration
> Oslo University College, Norway
>
> Personal Web: http://www.iu.hio.no/~mark
> Office Telf : +47 22453272
> -------------------------------------------------
>
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to