Hi,

I'm a newbie trying to figure out if I can migrate from some in-house 
scripts to cfengine3 for configuration management. As such, I'm struggling 
a little to think in the "cfengine3 way".

What is the idiomatic way of doing if...else statements in cfengine3? Is 
it inventing a default class, rather than relying on an absence of a 
class, like in the following?

    bundle common def {
       vars:
           "location_A" slist => {
               "some-host.com",
           };

           "location_B" slist => {
               "some-other-host.com",
           };

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

    bundle agent foo {
        files:
            location_A::

                # Stuff...

            location_B::

                # Different stuff...

            location_unknown::

                # Default stuff...
    }


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