diff options
Diffstat (limited to 'lib/puppet/ssl')
-rw-r--r-- | lib/puppet/ssl/host.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/puppet/ssl/host.rb b/lib/puppet/ssl/host.rb index 0e65d30b1..373ee5003 100644 --- a/lib/puppet/ssl/host.rb +++ b/lib/puppet/ssl/host.rb @@ -17,6 +17,25 @@ class Puppet::SSL::Host attr_reader :name attr_accessor :ca + # Search for more than one host, optionally only specifying + # an interest in hosts with a given file type. + def self.search(options = {}) + classes = [Key, CertificateRequest, Certificate] + if klass = options[:for] + classlist = [klass].flatten + else + classlist = [Key, CertificateRequest, Certificate] + end + args = {} + args[:in] = options[:in] if options[:in] + + # 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(args) }.flatten.collect { |r| r.name }.uniq.collect do |name| + new(name) + end + end + # A bit of metaprogramming that we use to define all of # the methods for managing our ssl-related files. def self.manage_file(name, &block) |