help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: methods and scripts [was: Re: cfengine ideology question]


From: Nielsen, Steve
Subject: RE: methods and scripts [was: Re: cfengine ideology question]
Date: Fri, 16 Apr 2004 10:35:01 -0400

Can you share how you use Text::Template in your cfengine setup? I have been 
wanting to do this. I have not attempted anything yet.

Steve

-----Original Message-----
From: Tim Nelson [mailto:address@hidden
Sent: Thursday, April 15, 2004 6:29 PM
To: Billy Allan
Cc: address@hidden
Subject: methods and scripts [was: Re: cfengine ideology question]


On Thu, 15 Apr 2004, Billy Allan wrote:

> On Thu, Apr 15, 2004 at 08:54:19AM +0200, address@hidden wrote:
> > The advantage of cfengine actions is their predictable behaviour
> > and reproducibility, so it is best to use them if possible. 
> > However, cfengine does not make very specialized script writing easy
> > and it is therefore necessary to call other scripts within the cfengine
> > framework. That allows you to
> >  - keep everything in one place
> >  - organize the script runs in relation to other config stuff
> >  - borrow some of the safety features of cfengine
> > 
> > Recently "methods" were introduced in cfengine to allow more
> > complex behaviours in cfengine scripts, but even with these there
> > will be times when your own script is better.
> 
> I haven't been following the "methods" stuff - something new to play
> with!  :-)
> 
> On another note though, I was wondering if it might be useful to be able
> to embed small scripts in an arbitory scripting language
> (shell/perl/python/whatever) in a conf file and have cfengine call the
> interpretor.

        I can actually do each of your examples with my current setup, in 
a manner of speaking.  The perl stuff I can do because I'm using perl's 
Text::Template on my cfengine config files before I send them out 
(server-side).  The shell stuff I can do in the shellcommands section 
(client-side).  I might also be able to do perl one-liners with 
shellcommands too.  
        Sorry to all on the list if it sounds like I keep harping on the 
Text::Template, but sometimes, it is the answer to the question :).  

        Mark, is there a way to do here-documents as input to 
shellcommands?  eg, something like:
-------------------------
shellcommands:
        any::
                <<EOT
....perl code here...
EOT
                > "perl"
-------------------------

        ...where "perl" is the shellcommand, > is redirection, and the 
<<EOT EOT stuf are the here document markers.  The would also achieve the 
functionality that this guy wants.  

[examples snipped]

> It might help reduce the cruft of little scripts which tend to appear on
> machines over time?

        I have a directory one my central server called ..../local/bin and 
use the cfengine copy stanza to copy things from there to each individual 
machine as appropriate.  

        :)

-- 
Tim Nelson
Systems Administrator
Sunet Internet
Tel: +61 3 5241 1155
Fax: +61 3 5241 6187
Web: http://www.sunet.com.au/
Email: address@hidden




_______________________________________________
Help-cfengine mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/help-cfengine




reply via email to

[Prev in Thread] Current Thread [Next in Thread]