On Thu, Dec 15, 2011 at 03:46:40PM -0500, Mark Burgess wrote: > >> vars: >> smb_shares slist => readstringlist( >> '/data/smb_shares.lst', '#', >> "\n\n", >> "1000", >> "64000"); >> files: >> "/etc/samba/smb.conf" >> perms => mog('644','root','root'), >> create => true, >> template_from => template('/templates/smb.conf'), >> classes => { promise_repaired('bounce_smbd', 'bounce_nmbd'), >> promise_kept(canonify("smbd.conf okay")), >> repair_failed('smbd_conf_error'), >> cancel_notkept(canonify("smbd.conf okay")), }; >> > >I don't understand where the smb shares comes into it, but any reason >why this doesn't work?
I was using smb.conf as an example of a structured file that operates in "blocks" instead of "lines" (such as /etc/aliases, or resolv.conf). > > files: > "/etc/samba/smb.conf" > perms => mog('644','root','root'), > create => true, > edit_line => expand_template('/templates/smb.conf'), > ... Because you still have to, as a separate step with additional complexity, write a promise to fetch the template from the server before you can do local expansion. Yes, I undestand that this is what must happen at a low level, but who cares? If I'm managing $BIGNUM systems, anything I can do to simplify the management process is a huge benefit. Instead, for any file I want to template, I have to write twice as many promises as I think should be nessacary, and deal with a "2nd tier" file repository location (i.e. "/templates") as well. I thought the idea was to make less work, not more? >If you imply that the file contains lists, then that brings up a few >issues about semantics that are unclear, but some solutions are given here: > >http://cfengine.com/manuals/st-editing.html#File-templates > >Lists inside template files are worth revisiting. Indeed. And permit nested lists and arrays as well. With those three things: 1-step templates, list iteration in templates and complex data structures, CFEngine would gain a tremendous amount of power. >Non-line based editing was never supported in CFEngine 2 or 3 (yet) but >if your files are reasonably well behaved, you can approimate a context >free language like sgml as a regular one, e.g. if the tags are on >separate lines In CF2, there was a concept of BeginGroup*, which I thought could be nested. It was, admittedly, an impartive way of dealing with files, and I understand that it doesn't fit well with a purely declaritive model. > ><ul> ><li> Item 1 ><li> Item 2 ></ul> > ><ol> > > >You could use > >body select_region MySection(x) > >{ >select_start => "<$(x)>"; >select_end => "</$(x)>"; >} > >To edit only within the section. I should add some examples of sections >to the STG... > > >M > > > > -- Jesse Becker NHGRI Linux support (Digicon Contractor) _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine