The right order in cfengine, revisited

Soon after posting The right order in cfengine, I asked in the help list if it was the right way to do it. To discover that my approach was a bit too overkill 🙂

So, while still a bit overkill, the following could be a much better approach: …

body common control
  bundlesequence => { "test" } ;
  inputs         => { "" } ;
  version        => "Slow convergence";

body classes always(x)

# Define a class no matter what the outcome of the promise is

  promise_repaired => { "$(x)" };
  promise_kept => { "$(x)" };
  repair_failed => { "$(x)" };
  repair_denied => { "$(x)" };
  repair_timeout => { "$(x)" };

bundle agent test {
	edit_defaults => empty,
	create => "true",
	edit_line => t2 ;


bundle edit_line t2 {
      "index" slist => { "a", "b", "c", "d" } ;

      "has_$(index)" expression => "trigger" ;

      "### header ###"
	classes => always("trigger") ;

      "this should be the second"
      	classes => always("step_a") ;

	classes => always("step_b") ;

	classes => always("step_c") ;

	classes => always("step_d") ;

      "last" ;

As you can see, it's basically the same thing, but now all of the file editing takes place in a single files: promise, with an edit_line bundle that applies all the needed insert_lines promises: much more logical.

I have to go now, and read the docs Mark Burgess posted. They look quite promising 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.