Forum: CFEngine Help
Subject: cf3 inputs, branching, selectiveness, staying sane
Author: jblaine
Link to topic: https://cfengine.com/forum/read.php?3,23400,23400#msg-23400

Hi everyone.  I've spent the last few days reading up on CFEngine 3, coming 
from a long time of 2.x use.

I've yet to see any real information on approaches to handling branching and 
managing input files, and surely people have figured some stuff out here, yet I 
can't find where it's being shared.  There's a Special Topics Guide which 
touches on this in very generic terms that I've not found all that helpful.

My first attempt failed miserably, where I tried to load only the relevant 
inputs based on class:

===============================================================
# BEGIN promises.cf
# ... text deleted here...
body common control {
    site_x::
        inputs => { "x.cf", "cfengine_stdlib.cf", "common.cf" };
    site_y::
        inputs => { "y.cf", "cfengine_stdlib.cf", "common.cf" };
}
# END promises.cf

# BEGIN x.cf
body common control {
    bundlesequence => { "site_x_stuff1", "site_x_stuff2" };
}

bundle agent site_x_stuff1 {
# blah blah
}

bundle agent site_x_stuff2 {
# blah blah
}
# END x.cf
===============================================================

This obviously failed due to the redefinition of "body common control" in the 
site-specific inputs.

So, aside from the first obvious question: "How do I load/validate/compile 
inputs only when needed?", I would love to see how others are solving this.  
I'm not about to go through the pain of migrating from 2.x to 3.x while 
repeating the same old mistakes made with 2.x.  Our 2.x config (working fine!) 
is a gigantic mess.

Is everyone just using something like "bundlesequence => { "everything" }; 
inputs => { "all", "of", "the", "files" };" and then something like:

bundle agent everything {
methods:
    site_x::
        "any" usebundle => "site_x_stuff1";
        "any" usebundle => "site_x_stuff2";
}

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to