[Puppet-users] Pupppet Ruby DSL

Matthew Palmer
Sat, 29 Jul 2006 00:11:38 -0000

On Fri, Jul 28, 2006 at 09:01:34AM +0200, David Schmitt
wrote:
> On Wednesday 26 July 2006 23:13, Luke Kanies wrote:
> > I still don''t know.  It feels like it''s basically as
restricted as
> > the language, but certainly it''s a heckuva lot less code than
> > Puppet''s parser is.
> >
> > Any comments?  Should I commit this to subversion, just to keep it
> > around in case people want to mess with it?
>
> The thing that bothers me, is: what''s the use-case? Most
applications seem to
> be doable as well by using some .pp compiler. e.g. creating a configuration
> from a tripwire database.

When you say ".pp compiler", do you mean a tool that writes a Puppet
manifest (.pp) file by using information from another source?  I don''t
really see how it''s any harder to do that if the language is Ruby
underneath
than if it''s the manifest language.

> In contrast to the current way of slowly migrating useful defines ans
custom
> types into puppet proper, allowing ruby in the configuration will reduce
the
> need to push such things upstream.

I thought this at first, too, but I''ve changed my mind there.  You see,
the
Ruby-based configuration specification gets turned into the same
intermediate form before it goes to the client -- it''s a big fat YAML
file
that describes all of your objects.  Being able to write Ruby in your
manifest does not allow you to manipulate things any better.  What it does
give you is:

* The ability to dynamically create manifests directly, using Ruby.  This
actually goes to your initial comment, above, about creating manifests from
other sources of host data, and it makes it *easier* than if you have to
write out a .pp file.

* A much reduced burden of having to write the base language primitives
yourself to describe the manifest, because you''ve got Ruby as your
parser
and interpreter.  Time saving.

> And last but not least, it''s probably not much trouble to write a
grammar that
> accepts .pp files and does something sensible with them (translating to
xml,
> creating statistics, querying a configuration of a host, cross references)
> using ruby as DSL one can use the ruby tools for that, but only them. This
> seems to balance out...

This is a valid concern.  It is almost certainly going to be harder to parse
a Ruby script than a .pp file.  However, with the .pp language growing more
complex to support more operations, you''d have a bit of a job making
sure
you had a completely valid parser in another language anyway.  I''d
suggest,
if you''re looking for a data form of a manifest to read, just use the
localconfig.yaml file.

- Matt