[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5
Paul Berry
paul at puppetlabs.com
Tue May 10 08:02:46 UTC 2011
The following commit has been merged in the experimental branch:
commit 71ecad9904c8c48c023e90e5fbea5b26b180c9cf
Author: Paul Berry <paul at puppetlabs.com>
Date: Mon Nov 29 11:56:40 2010 -0800
Maint: Refactor code to use <class>.indirection.<method>
Replaced uses of the find, search, destroy, and expire methods on
model classes with direct calls to the indirection objects. Also
removed the old methods that delegated to the indirection object.
diff --git a/lib/puppet/application/agent.rb b/lib/puppet/application/agent.rb
index c5ad720..96f3329 100644
--- a/lib/puppet/application/agent.rb
+++ b/lib/puppet/application/agent.rb
@@ -228,9 +228,9 @@ class Puppet::Application::Agent < Puppet::Application
# access to the local files and we don't need a ca.
Puppet::SSL::Host.ca_location = options[:fingerprint] ? :none : :remote
- Puppet::Transaction::Report.terminus_class = :rest
+ Puppet::Transaction::Report.indirection.terminus_class = :rest
# we want the last report to be persisted locally
- Puppet::Transaction::Report.cache_class = :yaml
+ Puppet::Transaction::Report.indirection.cache_class = :yaml
# Override the default; puppetd needs this, usually.
# You can still override this on the command-line with, e.g., :compiler.
@@ -239,8 +239,7 @@ class Puppet::Application::Agent < Puppet::Application
# Override the default.
Puppet[:facts_terminus] = :facter
- Puppet::Resource::Catalog.cache_class = :yaml
-
+ Puppet::Resource::Catalog.indirection.cache_class = :yaml
# We need tomake the client either way, we just don't start it
# if --no-client is set.
diff --git a/lib/puppet/application/apply.rb b/lib/puppet/application/apply.rb
index 8ec3fab..e5b4bb5 100644
--- a/lib/puppet/application/apply.rb
+++ b/lib/puppet/application/apply.rb
@@ -85,12 +85,12 @@ class Puppet::Application::Apply < Puppet::Application
end
# Collect our facts.
- unless facts = Puppet::Node::Facts.find(Puppet[:certname])
+ unless facts = Puppet::Node::Facts.indirection.find(Puppet[:certname])
raise "Could not find facts for #{Puppet[:certname]}"
end
# Find our Node
- unless node = Puppet::Node.find(Puppet[:certname])
+ unless node = Puppet::Node.indirection.find(Puppet[:certname])
raise "Could not find node #{Puppet[:certname]}"
end
@@ -112,7 +112,7 @@ class Puppet::Application::Apply < Puppet::Application
begin
# Compile our catalog
starttime = Time.now
- catalog = Puppet::Resource::Catalog.find(node.name, :use_node => node)
+ catalog = Puppet::Resource::Catalog.indirection.find(node.name, :use_node => node)
# Translate it to a RAL catalog
catalog = catalog.to_ral
@@ -149,7 +149,7 @@ class Puppet::Application::Apply < Puppet::Application
end
# we want the last report to be persisted locally
- Puppet::Transaction::Report.cache_class = :yaml
+ Puppet::Transaction::Report.indirection.cache_class = :yaml
if options[:debug]
Puppet::Util::Log.level = :debug
diff --git a/lib/puppet/application/kick.rb b/lib/puppet/application/kick.rb
index 37aeb1e..c6c6fd7 100644
--- a/lib/puppet/application/kick.rb
+++ b/lib/puppet/application/kick.rb
@@ -175,12 +175,12 @@ class Puppet::Application::Kick < Puppet::Application
if Puppet[:node_terminus] == "ldap" and (options[:all] or @classes)
if options[:all]
- @hosts = Puppet::Node.search("whatever", :fqdn => options[:fqdn]).collect { |node| node.name }
+ @hosts = Puppet::Node.indirection.search("whatever", :fqdn => options[:fqdn]).collect { |node| node.name }
puts "all: #{@hosts.join(", ")}"
else
@hosts = []
@classes.each do |klass|
- list = Puppet::Node.search("whatever", :fqdn => options[:fqdn], :class => klass).collect { |node| node.name }
+ list = Puppet::Node.indirection.search("whatever", :fqdn => options[:fqdn], :class => klass).collect { |node| node.name }
puts "#{klass}: #{list.join(", ")}"
@hosts += list
diff --git a/lib/puppet/application/master.rb b/lib/puppet/application/master.rb
index fde4749..879b66c 100644
--- a/lib/puppet/application/master.rb
+++ b/lib/puppet/application/master.rb
@@ -51,7 +51,7 @@ class Puppet::Application::Master < Puppet::Application
Puppet::Util::Log.newdestination :console
raise ArgumentError, "Cannot render compiled catalogs without pson support" unless Puppet.features.pson?
begin
- unless catalog = Puppet::Resource::Catalog.find(options[:node])
+ unless catalog = Puppet::Resource::Catalog.indirection.find(options[:node])
raise "Could not compile catalog for #{options[:node]}"
end
@@ -139,7 +139,7 @@ class Puppet::Application::Master < Puppet::Application
Puppet.settings.use :main, :master, :ssl
# Cache our nodes in yaml. Currently not configurable.
- Puppet::Node.cache_class = :yaml
+ Puppet::Node.indirection.cache_class = :yaml
# Configure all of the SSL stuff.
if Puppet::SSL::CertificateAuthority.ca?
diff --git a/lib/puppet/application/queue.rb b/lib/puppet/application/queue.rb
index 239f6b2..c7e0ce8 100644
--- a/lib/puppet/application/queue.rb
+++ b/lib/puppet/application/queue.rb
@@ -79,7 +79,7 @@ class Puppet::Application::Queue < Puppet::Application
exit(Puppet.settings.print_configs ? 0 : 1) if Puppet.settings.print_configs?
require 'puppet/resource/catalog'
- Puppet::Resource::Catalog.terminus_class = :active_record
+ Puppet::Resource::Catalog.indirection.terminus_class = :active_record
daemon.daemonize if Puppet[:daemonize]
@@ -87,6 +87,6 @@ class Puppet::Application::Queue < Puppet::Application
# class set up, because if storeconfigs is enabled,
# we'll get a loop of continually caching the catalog
# for storage again.
- Puppet::Resource::Catalog.cache_class = nil
+ Puppet::Resource::Catalog.indirection.cache_class = nil
end
end
diff --git a/lib/puppet/application/resource.rb b/lib/puppet/application/resource.rb
index f55caa5..3a7fdcc 100644
--- a/lib/puppet/application/resource.rb
+++ b/lib/puppet/application/resource.rb
@@ -76,12 +76,12 @@ class Puppet::Application::Resource < Puppet::Application
text = if name
if params.empty?
- [ Puppet::Resource.find( key ) ]
+ [ Puppet::Resource.indirection.find( key ) ]
else
[ Puppet::Resource.new( type, name, :parameters => params ).save( key ) ]
end
else
- Puppet::Resource.search( key, {} )
+ Puppet::Resource.indirection.search( key, {} )
end.map(&format).join("\n")
if options[:edit]
diff --git a/lib/puppet/configurer.rb b/lib/puppet/configurer.rb
index 1c06390..77a9065 100644
--- a/lib/puppet/configurer.rb
+++ b/lib/puppet/configurer.rb
@@ -224,7 +224,7 @@ class Puppet::Configurer
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))
+ result = Puppet::Resource::Catalog.indirection.find(Puppet[:certname], fact_options.merge(:ignore_terminus => true))
end
Puppet.notice "Using cached catalog"
result
@@ -237,7 +237,7 @@ class Puppet::Configurer
def retrieve_new_catalog(fact_options)
result = nil
@duration = thinmark do
- result = Puppet::Resource::Catalog.find(Puppet[:certname], fact_options.merge(:ignore_cache => true))
+ result = Puppet::Resource::Catalog.indirection.find(Puppet[:certname], fact_options.merge(:ignore_cache => true))
end
result
rescue SystemExit,NoMemoryError
diff --git a/lib/puppet/configurer/fact_handler.rb b/lib/puppet/configurer/fact_handler.rb
index 075a594..abe0320 100644
--- a/lib/puppet/configurer/fact_handler.rb
+++ b/lib/puppet/configurer/fact_handler.rb
@@ -16,7 +16,7 @@ module Puppet::Configurer::FactHandler
# compile them and then "cache" them on the server.
begin
reload_facter
- Puppet::Node::Facts.find(Puppet[:certname])
+ Puppet::Node::Facts.indirection.find(Puppet[:certname])
rescue SystemExit,NoMemoryError
raise
rescue Exception => detail
diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb
index 8bf1cd8..1e7229d 100644
--- a/lib/puppet/defaults.rb
+++ b/lib/puppet/defaults.rb
@@ -121,7 +121,7 @@ module Puppet
:hook => proc do |value|
require 'puppet/node/facts'
if value.to_s == "rest"
- Puppet::Node::Facts.cache_class = :yaml
+ Puppet::Node::Facts.indirection.cache_class = :yaml
end
end
},
@@ -152,7 +152,7 @@ module Puppet
Puppet.settings[:storeconfigs] = true
# But then we modify the configuration
- Puppet::Resource::Catalog.cache_class = :queue
+ Puppet::Resource::Catalog.indirection.cache_class = :queue
else
raise "Cannot disable asynchronous storeconfigs in a running process"
end
@@ -794,9 +794,9 @@ module Puppet
if value
require 'puppet/rails'
raise "StoreConfigs not supported without ActiveRecord 2.1 or higher" unless Puppet.features.rails?
- Puppet::Resource::Catalog.cache_class = :active_record unless Puppet.settings[:async_storeconfigs]
- Puppet::Node::Facts.cache_class = :active_record
- Puppet::Node.cache_class = :active_record
+ Puppet::Resource::Catalog.indirection.cache_class = :active_record unless Puppet.settings[:async_storeconfigs]
+ Puppet::Node::Facts.indirection.cache_class = :active_record
+ Puppet::Node.indirection.cache_class = :active_record
end
end
}
diff --git a/lib/puppet/file_bucket/dipper.rb b/lib/puppet/file_bucket/dipper.rb
index dbfcdcd..8d69389 100644
--- a/lib/puppet/file_bucket/dipper.rb
+++ b/lib/puppet/file_bucket/dipper.rb
@@ -47,7 +47,7 @@ class Puppet::FileBucket::Dipper
# Retrieve a file by sum.
def getfile(sum)
source_path = "#{@rest_path}md5/#{sum}"
- file_bucket_file = Puppet::FileBucket::File.find(source_path, :bucket_path => @local_path)
+ file_bucket_file = Puppet::FileBucket::File.indirection.find(source_path, :bucket_path => @local_path)
raise Puppet::Error, "File not found" unless file_bucket_file
file_bucket_file.to_s
diff --git a/lib/puppet/indirector.rb b/lib/puppet/indirector.rb
index 5b73757..b0cabab 100644
--- a/lib/puppet/indirector.rb
+++ b/lib/puppet/indirector.rb
@@ -32,31 +32,6 @@ module Puppet::Indirector
module ClassMethods
attr_reader :indirection
-
- def cache_class=(klass)
- indirection.cache_class = klass
- end
-
- def terminus_class=(klass)
- indirection.terminus_class = klass
- end
-
- # Expire any cached instance.
- def expire(*args)
- indirection.expire(*args)
- end
-
- def find(*args)
- indirection.find(*args)
- end
-
- def destroy(*args)
- indirection.destroy(*args)
- end
-
- def search(*args)
- indirection.search(*args)
- end
end
module InstanceMethods
diff --git a/lib/puppet/indirector/catalog/active_record.rb b/lib/puppet/indirector/catalog/active_record.rb
index fabb08e..5157fb5 100644
--- a/lib/puppet/indirector/catalog/active_record.rb
+++ b/lib/puppet/indirector/catalog/active_record.rb
@@ -30,7 +30,7 @@ class Puppet::Resource::Catalog::ActiveRecord < Puppet::Indirector::ActiveRecord
host.merge_resources(catalog.vertices)
host.last_compile = Time.now
- if node = Puppet::Node.find(catalog.name)
+ if node = Puppet::Node.indirection.find(catalog.name)
host.ip = node.parameters["ipaddress"]
host.environment = node.environment
end
diff --git a/lib/puppet/indirector/catalog/compiler.rb b/lib/puppet/indirector/catalog/compiler.rb
index 78be4ca..b80143a 100644
--- a/lib/puppet/indirector/catalog/compiler.rb
+++ b/lib/puppet/indirector/catalog/compiler.rb
@@ -88,7 +88,7 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
# Turn our host name into a node object.
def find_node(name)
begin
- return nil unless node = Puppet::Node.find(name)
+ return nil unless node = Puppet::Node.indirection.find(name)
rescue => detail
puts detail.backtrace if Puppet[:trace]
raise Puppet::Error, "Failed when searching for node #{name}: #{detail}"
diff --git a/lib/puppet/network/handler/filebucket.rb b/lib/puppet/network/handler/filebucket.rb
index 6aaa2df..ee10dbd 100755
--- a/lib/puppet/network/handler/filebucket.rb
+++ b/lib/puppet/network/handler/filebucket.rb
@@ -33,7 +33,7 @@ class Puppet::Network::Handler # :nodoc:
# Return the contents associated with a given md5 sum.
def getfile(md5, client = nil, clientip = nil)
- bucket = Puppet::FileBucket::File.find("md5:#{md5}")
+ bucket = Puppet::FileBucket::File.indirection.find("md5:#{md5}")
contents = bucket.contents
if client
diff --git a/lib/puppet/network/handler/fileserver.rb b/lib/puppet/network/handler/fileserver.rb
index 9abc7ee..5b4b17a 100755
--- a/lib/puppet/network/handler/fileserver.rb
+++ b/lib/puppet/network/handler/fileserver.rb
@@ -236,7 +236,7 @@ class Puppet::Network::Handler
unless hostname = (client || Facter.value("hostname"))
raise ArgumentError, "Could not find hostname"
end
- env = (node = Puppet::Node.find(hostname)) ? node.environment : nil
+ env = (node = Puppet::Node.indirection.find(hostname)) ? node.environment : nil
# And use the environment to look up the module.
(mod = Puppet::Node::Environment.new(env).module(module_name) and mod.files?) ? @mounts[MODULES].copy(mod.name, mod.file_directory) : nil
diff --git a/lib/puppet/network/handler/master.rb b/lib/puppet/network/handler/master.rb
index c21aafa..5b9dd33 100644
--- a/lib/puppet/network/handler/master.rb
+++ b/lib/puppet/network/handler/master.rb
@@ -49,7 +49,7 @@ class Puppet::Network::Handler
# Pass the facts to the fact handler
Puppet::Node::Facts.new(client, facts).save unless local?
- catalog = Puppet::Resource::Catalog.find(client)
+ catalog = Puppet::Resource::Catalog.indirection.find(client)
case format
when "yaml"
diff --git a/lib/puppet/network/http/webrick.rb b/lib/puppet/network/http/webrick.rb
index 8ed0b28..54bcf30 100644
--- a/lib/puppet/network/http/webrick.rb
+++ b/lib/puppet/network/http/webrick.rb
@@ -105,7 +105,7 @@ class Puppet::Network::HTTP::WEBrick
results[:SSLStartImmediately] = true
results[:SSLEnable] = true
- raise Puppet::Error, "Could not find CA certificate" unless Puppet::SSL::Certificate.find(Puppet::SSL::CA_NAME)
+ raise Puppet::Error, "Could not find CA certificate" unless Puppet::SSL::Certificate.indirection.find(Puppet::SSL::CA_NAME)
results[:SSLCACertificateFile] = Puppet[:localcacert]
results[:SSLVerifyClient] = OpenSSL::SSL::VERIFY_PEER
diff --git a/lib/puppet/node.rb b/lib/puppet/node.rb
index e8d58e6..5b0a986 100644
--- a/lib/puppet/node.rb
+++ b/lib/puppet/node.rb
@@ -57,7 +57,7 @@ class Puppet::Node
# Merge the node facts with parameters from the node source.
def fact_merge
- if facts = Puppet::Node::Facts.find(name)
+ if facts = Puppet::Node::Facts.indirection.find(name)
merge(facts.values)
end
rescue => detail
diff --git a/lib/puppet/node/facts.rb b/lib/puppet/node/facts.rb
index d84d541..612dc32 100755
--- a/lib/puppet/node/facts.rb
+++ b/lib/puppet/node/facts.rb
@@ -16,7 +16,7 @@ class Puppet::Node::Facts
# We want to expire any cached nodes if the facts are saved.
module NodeExpirer
def save(key, instance)
- Puppet::Node.expire(instance.name)
+ Puppet::Node.indirection.expire(instance.name)
super
end
end
diff --git a/lib/puppet/ssl/certificate_authority.rb b/lib/puppet/ssl/certificate_authority.rb
index 0c226ca..5725be4 100644
--- a/lib/puppet/ssl/certificate_authority.rb
+++ b/lib/puppet/ssl/certificate_authority.rb
@@ -63,7 +63,7 @@ class Puppet::SSL::CertificateAuthority
store = nil
store = autosign_store(auto) if auto != true
- Puppet::SSL::CertificateRequest.search("*").each do |csr|
+ Puppet::SSL::CertificateRequest.indirection.search("*").each do |csr|
sign(csr.name) if auto == true or store.allowed?(csr.name, "127.1.1.1")
end
end
@@ -93,7 +93,7 @@ class Puppet::SSL::CertificateAuthority
# Retrieve (or create, if necessary) the certificate revocation list.
def crl
unless defined?(@crl)
- unless @crl = Puppet::SSL::CertificateRevocationList.find(Puppet::SSL::CA_NAME)
+ unless @crl = Puppet::SSL::CertificateRevocationList.indirection.find(Puppet::SSL::CA_NAME)
@crl = Puppet::SSL::CertificateRevocationList.new(Puppet::SSL::CA_NAME)
@crl.generate(host.certificate.content, host.key.content)
@crl.save
@@ -109,7 +109,7 @@ class Puppet::SSL::CertificateAuthority
# Generate a new certificate.
def generate(name)
- raise ArgumentError, "A Certificate already exists for #{name}" if Puppet::SSL::Certificate.find(name)
+ raise ArgumentError, "A Certificate already exists for #{name}" if Puppet::SSL::Certificate.indirection.find(name)
host = Puppet::SSL::Host.new(name)
host.generate_certificate_request
@@ -169,7 +169,7 @@ class Puppet::SSL::CertificateAuthority
# List all signed certificates.
def list
- Puppet::SSL::Certificate.search("*").collect { |c| c.name }
+ Puppet::SSL::Certificate.indirection.search("*").collect { |c| c.name }
end
# Read the next serial from the serial file, and increment the
@@ -199,14 +199,14 @@ class Puppet::SSL::CertificateAuthority
# Print a given host's certificate as text.
def print(name)
- (cert = Puppet::SSL::Certificate.find(name)) ? cert.to_text : nil
+ (cert = Puppet::SSL::Certificate.indirection.find(name)) ? cert.to_text : nil
end
# Revoke a given certificate.
def revoke(name)
raise ArgumentError, "Cannot revoke certificates when the CRL is disabled" unless crl
- if cert = Puppet::SSL::Certificate.find(name)
+ if cert = Puppet::SSL::Certificate.indirection.find(name)
serial = cert.content.serial
elsif ! serial = inventory.serial(name)
raise ArgumentError, "Could not find a serial number for #{name}"
@@ -229,7 +229,7 @@ class Puppet::SSL::CertificateAuthority
csr = self_signing_csr
issuer = csr.content
else
- unless csr = Puppet::SSL::CertificateRequest.find(hostname)
+ unless csr = Puppet::SSL::CertificateRequest.indirection.find(hostname)
raise ArgumentError, "Could not find certificate request for #{hostname}"
end
issuer = host.certificate.content
@@ -251,14 +251,14 @@ class Puppet::SSL::CertificateAuthority
cert.save
# And remove the CSR if this wasn't self signed.
- Puppet::SSL::CertificateRequest.destroy(csr.name) unless self_signing_csr
+ Puppet::SSL::CertificateRequest.indirection.destroy(csr.name) unless self_signing_csr
cert
end
# Verify a given host's certificate.
def verify(name)
- unless cert = Puppet::SSL::Certificate.find(name)
+ unless cert = Puppet::SSL::Certificate.indirection.find(name)
raise ArgumentError, "Could not find a certificate for #{name}"
end
store = OpenSSL::X509::Store.new
@@ -271,7 +271,7 @@ class Puppet::SSL::CertificateAuthority
end
def fingerprint(name, md = :MD5)
- unless cert = Puppet::SSL::Certificate.find(name) || Puppet::SSL::CertificateRequest.find(name)
+ unless cert = Puppet::SSL::Certificate.indirection.find(name) || Puppet::SSL::CertificateRequest.indirection.find(name)
raise ArgumentError, "Could not find a certificate or csr for #{name}"
end
cert.fingerprint(md)
@@ -279,6 +279,6 @@ class Puppet::SSL::CertificateAuthority
# List the waiting certificate requests.
def waiting?
- Puppet::SSL::CertificateRequest.search("*").collect { |r| r.name }
+ Puppet::SSL::CertificateRequest.indirection.search("*").collect { |r| r.name }
end
end
diff --git a/lib/puppet/ssl/host.rb b/lib/puppet/ssl/host.rb
index 8a6f0aa..6539b05 100644
--- a/lib/puppet/ssl/host.rb
+++ b/lib/puppet/ssl/host.rb
@@ -43,31 +43,31 @@ class Puppet::SSL::Host
# Configure how our various classes interact with their various terminuses.
def self.configure_indirection(terminus, cache = nil)
- Certificate.terminus_class = terminus
- CertificateRequest.terminus_class = terminus
- CertificateRevocationList.terminus_class = terminus
+ Certificate.indirection.terminus_class = terminus
+ CertificateRequest.indirection.terminus_class = terminus
+ CertificateRevocationList.indirection.terminus_class = terminus
if cache
# This is weird; we don't actually cache our keys, we
# use what would otherwise be the cache as our normal
# terminus.
- Key.terminus_class = cache
+ Key.indirection.terminus_class = cache
else
- Key.terminus_class = terminus
+ Key.indirection.terminus_class = terminus
end
if cache
- Certificate.cache_class = cache
- CertificateRequest.cache_class = cache
- CertificateRevocationList.cache_class = cache
+ Certificate.indirection.cache_class = cache
+ CertificateRequest.indirection.cache_class = cache
+ CertificateRevocationList.indirection.cache_class = cache
else
# Make sure we have no cache configured. puppet master
# switches the configurations around a bit, so it's important
# that we specify the configs for absolutely everything, every
# time.
- Certificate.cache_class = nil
- CertificateRequest.cache_class = nil
- CertificateRevocationList.cache_class = nil
+ Certificate.indirection.cache_class = nil
+ CertificateRequest.indirection.cache_class = nil
+ CertificateRevocationList.indirection.cache_class = nil
end
end
@@ -94,7 +94,7 @@ class Puppet::SSL::Host
# Remove all traces of a given host
def self.destroy(name)
- [Key, Certificate, CertificateRequest].collect { |part| part.destroy(name) }.any? { |x| x }
+ [Key, Certificate, CertificateRequest].collect { |part| part.indirection.destroy(name) }.any? { |x| x }
end
# Search for more than one host, optionally only specifying
@@ -106,7 +106,7 @@ class Puppet::SSL::Host
# Collect the results from each class, flatten them, collect all of the names, make the name list unique,
# then create a Host instance for each one.
- classlist.collect { |klass| klass.search }.flatten.collect { |r| r.name }.uniq.collect do |name|
+ classlist.collect { |klass| klass.indirection.search }.flatten.collect { |r| r.name }.uniq.collect do |name|
new(name)
end
end
@@ -117,7 +117,7 @@ class Puppet::SSL::Host
end
def key
- @key ||= Key.find(name)
+ @key ||= Key.indirection.find(name)
end
# This is the private key; we can create it from scratch
@@ -135,7 +135,7 @@ class Puppet::SSL::Host
end
def certificate_request
- @certificate_request ||= CertificateRequest.find(name)
+ @certificate_request ||= CertificateRequest.indirection.find(name)
end
# Our certificate request requires the key but that's all.
@@ -159,8 +159,8 @@ class Puppet::SSL::Host
# get the CA cert first, since it's required for the normal cert
# to be of any use.
- return nil unless Certificate.find("ca") unless ca?
- return nil unless @certificate = Certificate.find(name)
+ return nil unless Certificate.indirection.find("ca") unless ca?
+ return nil unless @certificate = Certificate.indirection.find(name)
unless certificate_matches_key?
raise Puppet::Error, "Retrieved certificate does not match private key; please remove certificate from server and regenerate it with the current key"
@@ -212,7 +212,7 @@ class Puppet::SSL::Host
@ssl_store.add_file(Puppet[:localcacert])
# If there's a CRL, add it to our store.
- if crl = Puppet::SSL::CertificateRevocationList.find(CA_NAME)
+ if crl = Puppet::SSL::CertificateRevocationList.indirection.find(CA_NAME)
@ssl_store.flags = OpenSSL::X509::V_FLAG_CRL_CHECK_ALL|OpenSSL::X509::V_FLAG_CRL_CHECK if Puppet.settings[:certificate_revocation]
@ssl_store.add_crl(crl.content)
end
diff --git a/lib/puppet/ssl/inventory.rb b/lib/puppet/ssl/inventory.rb
index b2b402a..e094da1 100644
--- a/lib/puppet/ssl/inventory.rb
+++ b/lib/puppet/ssl/inventory.rb
@@ -36,7 +36,7 @@ class Puppet::SSL::Inventory
f.print "# Inventory of signed certificates\n# SERIAL NOT_BEFORE NOT_AFTER SUBJECT\n"
end
- Puppet::SSL::Certificate.search("*").each { |cert| add(cert) }
+ Puppet::SSL::Certificate.indirection.search("*").each { |cert| add(cert) }
end
# Find the serial number for a given certificate.
diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb
index f35a264..0a07b67 100644
--- a/lib/puppet/type/file.rb
+++ b/lib/puppet/type/file.rb
@@ -587,7 +587,7 @@ Puppet::Type.newtype(:file) do
def perform_recursion(path)
- Puppet::FileServing::Metadata.search(
+ Puppet::FileServing::Metadata.indirection.search(
path,
:links => self[:links],
diff --git a/lib/puppet/type/file/source.rb b/lib/puppet/type/file/source.rb
index 7d03de2..19dabbd 100755
--- a/lib/puppet/type/file/source.rb
+++ b/lib/puppet/type/file/source.rb
@@ -98,7 +98,7 @@ module Puppet
cached_attr(:content) do
raise Puppet::DevError, "No source for content was stored with the metadata" unless metadata.source
- unless tmp = Puppet::FileServing::Content.find(metadata.source)
+ unless tmp = Puppet::FileServing::Content.indirection.find(metadata.source)
fail "Could not find any content at %s" % metadata.source
end
tmp.content
@@ -148,7 +148,7 @@ module Puppet
result = nil
value.each do |source|
begin
- if data = Puppet::FileServing::Metadata.find(source)
+ if data = Puppet::FileServing::Metadata.indirection.find(source)
result = data
result.source = source
break
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list