diff options
author | Luke Kanies <luke@madstop.com> | 2008-04-01 18:24:46 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-04-15 21:34:06 -0500 |
commit | c98ad25403dbb27289048513af48d0b3e1723b18 (patch) | |
tree | 15a544c0666d276fc645ccd9ff45d3d76f2f3b8a /lib/puppet/ssl | |
parent | d184b3539db2e857b8df424171a1beed4560a035 (diff) | |
download | puppet-c98ad25403dbb27289048513af48d0b3e1723b18.tar.gz puppet-c98ad25403dbb27289048513af48d0b3e1723b18.tar.xz puppet-c98ad25403dbb27289048513af48d0b3e1723b18.zip |
Adding a :search method to the ssl_file terminus type
and the SSL::Host class.
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) |