On Wed, 14 Dec 2011, Mark Burgess wrote:

>
> Mark, see this doc:
>
> http://www.cfengine.com/manuals/st-devops.html#Getting-used-to-declarative-expression
>
> M

Thanks Mark, much appreciated: I had missed the link to the special topics 
guides.

However, it wasn't the "if" bit I was fuzzy about, it was how people use 
the language to do the job of an "if..elif..else" construct in the 
clearest and least fragile way.

Extending the example on the devops page naively would mean that the 
"else" part will quickly become unmanageable.

In my example, I created a third class to play this role and act as a 
default:

...
>>         classes:
>>             location_A       expression =>  classify("$(location_A)");
>>             location_B       expression =>  classify("$(location_B)");
>>             location_unknown not        =>  classmatch("location_.*");
...

Is this the sort of way people do it in practice?

If so, it clearly shows I need to think carefully about the structure of 
class names to aid with pattern matching.

Thanks,

Mark
-- 
-----------------------------------------------------------------
Mark Dixon                       Email    : m.c.di...@leeds.ac.uk
HPC/Grid Systems Support         Tel (int): 35429
Information Systems Services     Tel (ext): +44(0)113 343 5429
University of Leeds, LS2 9JT, UK
-----------------------------------------------------------------
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to