Hi Mark, all

Il 29/02/2012 14:45, Mark Burgess ha scritto:
> there is nothing wrong with what you did, but it is probably a lot
> more complicated than you need to make it.

...which is good news :)


> I think you need to ask yourself a
> question:
> 
> 1. What is the use-case for having things in a particular order (is
> there one, or is this just to make you feel better) - see the discussion at
> http://cfengine.com/markburgess/blog_order.html

Read it, that was interesting. And it's interesting to see that,
centuries after Avogadro, there is still resistance to fully proved
theories. But that's another story.

As I said elsewhere, having stuff in a file in a certain order can help
a lot in all of those environments where configuration management is not
fully accepted, and people still rely on configuration files presenting
directives in a common, broadly used order.

That's why order in a configuration file is still important to me, even
if it's not to a program.


> 2. Is this specifically about file editing?

yes


> If so, there are *MUCH* simpler ways of ensuring the order of the
> content of a file, and you should not be editing the same file 10
> times to add 10 lines.

Yep, after reading your mail I realized I could work in a different
step, using a single edit_line bundle instead of many different files
promises. I'll try that!


> The approach you are using now is suitable for orchestrating changes of
> many different types and with complex interations between files,
> packages and processes etc. It is completely overkill for file editing,
> and is not really necessary if your promises are all of the same type.

I can see that now, thanks.


> To ensure order in file editing,
> 
> 1. Drop the standard library functions and use edit_line bundles with
> "preserve_block" to get more flexibility
> 2. Use a template (I have added a new template interface after our last
> conversation that you can see)

OK


> files:
> 
>   "destination file"
> 
>     edit_template => "/my/file";
> 
> Please see the attached special topics guide for details. This will be
> in the CFEngine 3.3.0 when released (soon).

Will do, thanks!


> Normally you could get a snapshot from the online repo, but we are
> currently migrating to git, so it is not up to date right now. I am
> attaching a tarball for your convenience.

Thanks a lot!

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

Reply via email to