[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35
test branch
puppet-dev at googlegroups.com
Wed Jul 14 10:32:33 UTC 2010
The following commit has been merged in the upstream branch:
commit 7e1e76e91579a49c07aa5cb5917a9800d59b8137
Author: Luke Kanies <luke at reductivelabs.com>
Date: Tue Mar 23 23:58:54 2010 -0700
Refactoring Configurer to enable the next feature
Signed-off-by: Luke Kanies <luke at reductivelabs.com>
diff --git a/lib/puppet/configurer.rb b/lib/puppet/configurer.rb
index aa336b4..3b4f9ec 100644
--- a/lib/puppet/configurer.rb
+++ b/lib/puppet/configurer.rb
@@ -94,47 +94,23 @@ class Puppet::Configurer
# Get the remote catalog, yo. Returns nil if no catalog can be found.
def retrieve_catalog
- name = Puppet[:certname]
- catalog_class = Puppet::Resource::Catalog
-
# This is a bit complicated. We need the serialized and escaped facts,
# and we need to know which format they're encoded in. Thus, we
# get a hash with both of these pieces of information.
fact_options = facts_for_uploading()
# First try it with no cache, then with the cache.
- result = nil
- begin
- duration = thinmark do
- result = catalog_class.find(name, fact_options.merge(:ignore_cache => true))
- end
- rescue SystemExit,NoMemoryError
- raise
- rescue Exception => detail
- puts detail.backtrace if Puppet[:trace]
- Puppet.err "Could not retrieve catalog from remote server: %s" % detail
- end
-
- unless result
+ unless result = retrieve_new_catalog(fact_options)
if ! Puppet[:usecacheonfailure]
Puppet.warning "Not using cache on failed catalog"
return nil
end
-
- begin
- duration = thinmark do
- result = catalog_class.find(name, fact_options.merge(:ignore_terminus => true))
- end
- Puppet.notice "Using cached catalog"
- rescue => detail
- puts detail.backtrace if Puppet[:trace]
- Puppet.err "Could not retrieve catalog from cache: %s" % detail
- end
+ result = retrieve_catalog_from_cache(fact_options)
end
return nil unless result
- convert_catalog(result, duration)
+ convert_catalog(result, @duration)
end
# Convert a plain resource catalog into our full host catalog.
@@ -230,4 +206,31 @@ class Puppet::Configurer
raise CommandHookError, "Could not run command from #{setting}: #{detail}"
end
end
+
+ def retrieve_catalog_from_cache(fact_options)
+ result = nil
+ @duration = thinmark do
+ result = Puppet::Resource::Catalog.find(Puppet[:certname], fact_options.merge(:ignore_terminus => true))
+ end
+ Puppet.notice "Using cached catalog"
+ result
+ rescue => detail
+ puts detail.backtrace if Puppet[:trace]
+ Puppet.err "Could not retrieve catalog from cache: %s" % detail
+ return nil
+ end
+
+ def retrieve_new_catalog(fact_options)
+ result = nil
+ @duration = thinmark do
+ result = Puppet::Resource::Catalog.find(Puppet[:certname], fact_options.merge(:ignore_cache => true))
+ end
+ result
+ rescue SystemExit,NoMemoryError
+ raise
+ rescue Exception => detail
+ puts detail.backtrace if Puppet[:trace]
+ Puppet.err "Could not retrieve catalog from remote server: %s" % detail
+ return nil
+ end
end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list