Forum: Cfengine Help
Subject: Re: .cf file includes?
Author: matter
Link to topic: https://cfengine.com/forum/read.php?3,20701,20707#msg-20707

I became curious if you could do this, and for a quick hack, yes. For 
simplicity sake - ls_test.cf does not live in $(sys.workdir)/inputs.


 % cat /var/cfengine/ls_test.cf
##########################################################################

body common control {

    bundlesequence => { "test1","test2" };
    inputs         => { @(bundles.inputs) };

}


##########################################################################

bundle common bundles {

 vars:

    "inputs_string" string => execresult("/bin/ls -m 
$(sys.workdir)/inputs/*.cf","useshell");
    "inputs"         slist => { splitstring("$(inputs_string)",", ","10") };


}


##########################################################################


and now the *.cf files in $(sys.workdir)/inputs


% cat /var/cfengine/inputs/test1.cf
##########################################################################

bundle agent test1 {

  reports:

    cfengine_3::

       "Test 1";

}

##########################################################################
% cat /var/cfengine/inputs/test2.cf
bundle agent test2 {

  reports:

    cfengine_3::

       "Test 2";

}



and the run


% cf-agent -Kf /var/cfengine/ls_test.cf
R: Test 1
R: Test 2


So, you can do it.

_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to