[Puppet-users] Pupppet Ruby DSL

David Lutterkort
Mon, 31 Jul 2006 15:44:41 -0000

On Wed, 2006-07-26 at 14:13 -0700, 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?


I guess it all depends ;) Going from the current puppet language to
embedding in Ruby gives you the full power of Ruby, and gives up some of
the abstraction that the current puppet language enforces. When you
embed in Ruby, you completely lose control of what people do in their
manifests (e.g., connect to some other server and get some information
from that) It seems that that would make it much harder to convince
people that a given manifest doesn''t have any nasty side effects.

Right now, it''s also pretty clear what the input and output of a
manifest are: in go the facts (and not much else) and out comes a list
of transportable objects. With an embedded Ruby language, this becomes a
lot murkier.

To me there is a fundamental difference between e.g. Rails and Puppet,
in that when you write a rails app you are really writing a ruby app,
and you want some conveniences for things that are frequently needed in
a webapp. Writing a puppet manifest to me is much less about writing a
ruby program, and more giving a static description of what a given
system should look like.

As for the example you gave, I am not sure if a Ruby class is really a
perfect fit for a puppet class; for example, multiple inheritance in
puppet would make perfect sense, given the restrictions on elements that
can be applied to a given host, while ruby (for good reason) doesn''t
support multiple inheritance.

Another good question in this context is where exactly the line of
abstraction should run. Right now there are two: one is given by the
transportable objects, and the other by the manifests themselves. If
manifests ever need to be communicated to something else (a DB, a
non-Ruby app) a separate puppet language is definitely needed.

David