Il 29/02/2012 18:31, no-re...@cfengine.com ha scritto:
> First of all, *aw shucks* thanks for the very nice words about the
> book in your post :)

My pleasure, that's much deserved!


> Second, I would agree with everything that Mark said, and encourage
> you to look at the new edit_template attribute. It makes things like
> this much easier by allowing you to embed class-conditioned blocks in
> a file template, among other things.

Yep, I've looked at the new templates, and I agree that is a major step
forward. Thanks for doing that!


> Third, whenever I find myself trying too hard to bend CFEngine's
> behavior into my way of thinking, I try to step back and look at the
> bigger picture. In this particular case, I would wonder whether order
> in this file is really important, or if I want it just for aesthetic
> benefit. If order is really important, is it just within certain
> blocks? When you could use the preserve_block attribute.

In this case, it was more of a proof of concept for me. I've fought with
this problem in the past, and couldn't find a good way to do it. After
reading your book and those class wizardries to change the normal order
I thought: "WOW! I think I could try to force a number of lines in a
file in a certain order, but... will it converge quick enough?".

That's why the file contains many lines and not just three :) I wanted
to be sure that I could both force a certain order, and that I could
make it quick enough that it could fit in three passes.

Today I learnt more about how classes are defined in the various passes,
and also that I can actually force certain operations in a certain
order, if I have the need. Overkill? Sure! Could be done much, much
better? Damn yes it could! But... hey! I made it! Isn't that an
achievement? ;-)


> And a final technique I try is to remove all my flow-control code
> (class settings and conditions) and write just the CFEngine code, and
> try it out. More often than not CFEngine surprises me by doing the
> right things without needing my handholding.

I tend to do the opposite actually :) First, put out the insert_line
rules and see if it does what I want/expect. If it doesn't, I look for
alternatives (which, as you suggest, could involve a "step back"
approach to reconsider the problem).

Thanks again

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

Reply via email to