Il 01/11/2011 17:13, no-re...@cfengine.com ha scritto:
> It sounds like your rules boil down to:
> "insert this multi-line header at the top"
> "insert several lines based on conditions which could be defined as
> classes"

More or less, yes. See below.


> you basically have just a few classes needed:
> is_unicast_ntp_server
> is_multicast_ntp_server
> is_multicast_ntp_client
> is_unicast_ntp_client

I have those four, even if named differently, yes.


> Then everything else is just an edit line promise, using key=value
> form.  Define your header as a scalar,

doable, but I don't like having either multi-line scalars or super-long
scalars across one line (the header string in one line and using
$(const.n)). I feel it impairs readability.


> do your edits with the
> empty_file rule, and rebuild the file from the ground up.  You don't
> even need a template for that.  Most ntp configurations I'm aware of
> don't have any kind of order neccesary.

that's true in this case, but most of the time order matters in a config
file (think of an INI file for a very common example, or ssh_config
stanzas).

I am trying to understand how I should do to create a file when
different sections depend on different conditions, and these sections
must appear in the file in a well-defined order.

Any hint is appreciated. In the meanwhile, I keep running around in my
trial-and-error loop.

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

Reply via email to