# File lib/puppet/configurer.rb, line 81
 81:     def retrieve_catalog
 82:         name = Puppet[:certname]
 83:         catalog_class = Puppet::Resource::Catalog
 84: 
 85:         # This is a bit complicated.  We need the serialized and escaped facts,
 86:         # and we need to know which format they're encoded in.  Thus, we
 87:         # get a hash with both of these pieces of information.
 88:         fact_options = facts_for_uploading()
 89: 
 90:         # First try it with no cache, then with the cache.
 91:         result = nil
 92:         begin
 93:             duration = thinmark do
 94:                 result = catalog_class.find(name, fact_options.merge(:ignore_cache => true))
 95:             end
 96:         rescue => detail
 97:             puts detail.backtrace if Puppet[:trace]
 98:             Puppet.err "Could not retrieve catalog from remote server: %s" % detail
 99:         end
100: 
101:         unless result
102:             if ! Puppet[:usecacheonfailure]
103:                 Puppet.warning "Not using cache on failed catalog"
104:                 return nil
105:             end
106: 
107:             begin
108:                 duration = thinmark do
109:                     result = catalog_class.find(name, fact_options.merge(:ignore_terminus => true))
110:                 end
111:                 Puppet.notice "Using cached catalog"
112:             rescue => detail
113:                 puts detail.backtrace if Puppet[:trace]
114:                 Puppet.err "Could not retrieve catalog from cache: %s" % detail
115:             end
116:         end
117: 
118:         return nil unless result
119: 
120:         convert_catalog(result, duration)
121:     end