>
> Hey,
>
> I am new in the puppet code and I am trying to write a patch for this
> feature, but I need some advice about the global design.
> How could I manage the fact that there is many packages, do I have to
> create another type that handle multiple packages ?
> I have to select packages that could be install without breaking the
> dependency graph, how could I make this new type part of the graph ?
> And, where does it should be handle in the process ?
> How can I link this new "metatype" with the existing providers ?
I don't think a new type is either necessary or a good idea. The
critical issue is the interface between the package provider and the
transaction, and it should look somewhat like how prefetching looks.
In terms of ordering, there are basically two choices: Combine
adjacent packages, or just combine all packages. I expect that most
package types would be fine combining all packages into a single call,
but there should be a new package parameter added to allow people to
disable this.
So, the transaction would have to track what kinds of packages it had
run into, with a method something like this:
def eval_resource
...
if resource.provider.class.respond_to?(:install_multiple)
events = install_multiple(resource)
else
...
end
end
def install_multiple(resource)
provider_class = resource.provider.class
@multiple_install_events ||= {}
@multiple_install_events[provider_class] ||= {}
if event = @multiple_install_events[provider_class][resource.path]
return event
end
# Find all resources matching the provider class that set combining
resource_names = catalog.vertices.collect { |r|
r.provider.class.equal?(provider.class) }.reject { |r| r[:combine] ==
false }.collect { |r| r[:name] }
@multiple_install_events[provider_class] =
provider_class.install_multiple(resource_names)
@multiple_install_events[provider_class][resource.path]
end
----
Obviously this isn't quite right, but you get the idea -- you need to
have per-resource events, so that notification and dependencies work
correctly, but otherwise you want to combine everything.
You'll also need to check all of the resources first to see if they're
in sync - you don't want to include packages that are already
installed in the list to be installed.
--
Honest criticism is hard to take, particularly from a relative, a
friend, an acquaintance, or a stranger. -- Franklin P. Jones
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com
> Obviously this isn't quite right, but you get the idea -- you need to
> have per-resource events, so that notification and dependencies work
> correctly, but otherwise you want to combine everything.
Such a feature would be awesome !
We are using Puppet to install Ubuntu workstations on which we are
installing about 200 packages. The initial puppet run takes
approximatively 20 minutes to finish.
A single call to apt-get or aptitude would certainly shorten this
operation quite a bit.
François
These could actually be shortened quite a bit with existing
infrastructure by adding prefetching support to apt/aptitude. That
would cut out one call to apt-cache for every package.
--
"They called me mad, and I called them mad, and damn them, they
outvoted me." -- Nathaniel Lee, on being consigned to a mental
institution, circa 17th c.