On 6/7/2010 3:08 AM, Daniel Pittman wrote:
Luke Kanies<[email protected]>  writes:
To me, we need to be focusing on fixing Collection so it actually works well
for this purpose.  It sounds like most of Daniel Pittman's needs would be
solved by better resource collection.

Well, maybe.  One use case, which is pretty obvious, is our load balancer
configuration, which needs to wind up looking like this:

     virtual=10.17.0.1:80
     <% appserver_addresses.each do |addr| -%>
       real=<%= addr %>:80
     <% end -%>

All I really need to do for this to work is collect the 'ipaddress_eth0' fact
from every node that imports the 'appserver' class into an array.

This model meets ... well, probably not all my needs, but plenty of them.


The real problem, so far as I can see, with this and using resource collection
is that unless your resource is a "fact" I *have* to go down to the Ruby
level, right?

No. This could look like this:

class ldirector::server {
concat { "/etc/ldirector.conf": ... }
concat::fragment {
  "ldirector_header":
    content => "virtual=10.17.0.1:80\n",
    order => 1
}
Concat::Fragment <<| tag = "ldirector::client" |>>
}

class ldirector::client {
@@concat::fragment {
  "ldirector_${fqdn}_real":
    content => "real=${ipaddress_eth0}\n",
    order => 2;
}
}

Of course, this could be refined by wrapping the concat::fragment into a ldirector::config define, but that's not the point.

Specifically, as far as I know I can't define a "resource" inside puppet that
is composed into another resource: the "real=1.2.3.4:80" line can't be a
separate resource from the ldirectord.cf file that it is contained within.

Using the R.I.Pienaar's concat module you can manage the file on a chunk-by-chunk basis. If you use augeas, you can manage the file as finegrained as allowed by the available lenses.

I am open to adding support for pulling attributes from the database in
general, I just don't think that's actually the right long-term answer.

Well, I don't really care how this works in the end — I think that the current
model where you can't define composed resources without Ruby is nasty, but
I am not sure anyone (myself included) has a better model, right now...

Both concat and augeas do work without using ruby, although both do have their specific limitations.


Best Regards, David
--
dasz.at OG              Tel: +43 (0)664 2602670     Web: http://dasz.at
Klosterneuburg                                         UID: ATU64260999

       FB-Nr.: FN 309285 g          FB-Gericht: LG Korneuburg

--
You received this message because you are subscribed to the Google Groups "Puppet 
Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to