Niek-

Only one set of promises is ever run.  By default that comes from promises.cf,
but you can specify an alternative set with -f.  Those promises can consist
of many other files, which you list in the inputs.  Regardless of which files
are included, the agent only runs the promises listed in the bundlesequence
(and there is only one bundlesequence).

So what you created was a standalone set of promises (with one promise), and
a bundlesequence saying "run that one promise bundle).

If you want to include that new set of promises into the "main" set of
promises in promises.cf, you add "tester" to the bundlesequence in promises.cf,
add test.cf to your list of inputs, and delete (or comment out) the body
common control in test.cf (because like Highlander, there can be only one!)

FYI, you also could have done your testing on test.cf without a body common
control and a bundlesequence inside of it.  All you would need to do is say
"cf-agent -b tester -f ./test.cf" (where the -b or --bundlesequence flag says
"build a temporary bundlesquence for this run").  In fact, you can use -b to
only run specific bundles for any config, including promises.cf

-Dan (also known as '*' :-)

> Dear *,
> 
> I am playing around with cfengine now for a couple of days. One thing
> that is still not clear to me is how to include new promises. For
> example i have created the following promise (test.cf):
> 
> body common control
> {
>     bundlesequence => { "tester" };
>     version => "0.1";
> }
> 
> bundle agent tester
> {
>     files:
>         "/tmp/tester"
>              comment => "This is a tester!",
>              create => "true";
> }
> 
> The promise is located in '/var/cfengine/inputs'. This promise just
> creates a file. I have no idea how to make sure the promise will be
> executed automatically when cf-agent is run. The promise works when I
> run 'cf-agent -f ./test.cf'. What I did in order to execute this is add
> the following to 'promises.cf':
> 
> 1. add "tester" to bundlesequence
> 2. add "test.cf" to inputs
> 
> In order to let this work I needed to remove the following from test.cf
> otherwise it would complain that it is called redundantly:
> 
> body common control
> {
>     bundlesequence => { "tester" };
>     version => "0.1";
> }
> 
> I don't think I am on the right track with calling my promise. So to sum
> it all up, my question was, what do I need to configure in order to load
> the test.cf promise?
> 
> Kind Regards,
> 
> Niek Timmers
> University of Amsterdam
> 
> _______________________________________________
> 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

Reply via email to