From d8937acb8c9b108e61330cbac703a17b2eaba9b3 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Fri, 18 Jul 2008 00:54:59 -0500 Subject: You can now select the encoding format when transferring the catalog, with 'yaml' still being the default but 'marshal' being an option. This is because testing has shown drastic performance differences between the two, with up to 70% of compile time being spent in YAML code. Use the 'catalog_format' setting to choose your format, and the setting must be set on the client. Signed-off-by: Luke Kanies --- lib/puppet/network/client/master.rb | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'lib/puppet/network/client') diff --git a/lib/puppet/network/client/master.rb b/lib/puppet/network/client/master.rb index 0de3a117b..2da6cf890 100644 --- a/lib/puppet/network/client/master.rb +++ b/lib/puppet/network/client/master.rb @@ -143,15 +143,20 @@ class Puppet::Network::Client::Master < Puppet::Network::Client # If we can't retrieve the catalog, just return, which will either # fail, or use the in-memory catalog. - unless yaml_objects = get_actual_config(facts) + unless marshalled_objects = get_actual_config(facts) use_cached_config(true) return end begin - objects = YAML.load(yaml_objects) + case Puppet[:catalog_format] + when "marshal": objects = Marshal.load(marshalled_objects) + when "yaml": objects = YAML.load(marshalled_objects) + else + raise "Invalid catalog format '%s'" % Puppet[:catalog_format] + end rescue => detail - msg = "Configuration could not be translated from yaml" + msg = "Configuration could not be translated from %s" % Puppet[:catalog_format] msg += "; using cached catalog" if use_cached_config(true) Puppet.warning msg return @@ -175,7 +180,7 @@ class Puppet::Network::Client::Master < Puppet::Network::Client end if ! @catalog.from_cache - self.cache(yaml_objects) + self.cache(marshalled_objects) end # Keep the state database up to date. @@ -442,7 +447,7 @@ class Puppet::Network::Client::Master < Puppet::Network::Client benchmark(:debug, "Retrieved catalog") do # error handling for this is done in the network client begin - textobjects = @driver.getconfig(textfacts, "yaml") + textobjects = @driver.getconfig(textfacts, Puppet[:catalog_format]) begin textobjects = CGI.unescape(textobjects) rescue => detail -- cgit