summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-02-07 17:07:15 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-02-07 17:07:15 +0000
commitf1ffc34c0927840beeb21e1e2d864ce14de5d15e (patch)
treeb68a8795301d04393e56e540bb61ba73791a47d2 /lib
parent6affe220db1248cee8489347dc7d7ac071a534e4 (diff)
downloadpuppet-f1ffc34c0927840beeb21e1e2d864ce14de5d15e.tar.gz
puppet-f1ffc34c0927840beeb21e1e2d864ce14de5d15e.tar.xz
puppet-f1ffc34c0927840beeb21e1e2d864ce14de5d15e.zip
Configuration parameters now require (and have) descriptions, and a set of configuration parameters can be converted to a configuration file, a manifest, or a component. All I have to do now is integrate them into the executables.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@872 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet.rb218
-rw-r--r--lib/puppet/client/master.rb4
-rw-r--r--lib/puppet/config.rb236
-rw-r--r--lib/puppet/parser/ast.rb6
-rw-r--r--lib/puppet/parser/ast/objectdef.rb2
-rwxr-xr-xlib/puppet/server/fileserver.rb4
-rw-r--r--lib/puppet/sslcertificates/ca.rb119
-rw-r--r--lib/puppet/transportable.rb1
8 files changed, 335 insertions, 255 deletions
diff --git a/lib/puppet.rb b/lib/puppet.rb
index f2e365d63..fa3aafb87 100644
--- a/lib/puppet.rb
+++ b/lib/puppet.rb
@@ -1,6 +1,7 @@
require 'singleton'
require 'puppet/event-loop'
require 'puppet/log'
+require 'puppet/config'
require 'puppet/util'
# see the bottom of the file for further inclusions
@@ -57,8 +58,12 @@ module Puppet
class DevError < Error; end
+ def self.name
+ $0.gsub(/.+#{File::SEPARATOR}/,'')
+ end
+
# the hash that determines how our system behaves
- @@config = Hash.new(false)
+ @@config = Puppet::Config.new
# define helper messages for each of the message levels
Puppet::Log.eachlevel { |level|
@@ -78,91 +83,90 @@ module Puppet
# XXX this isn't actually working right now
alias :error :err
- @defaults = {
- :name => $0.gsub(/.+#{File::SEPARATOR}/,''),
- :rrddir => [:puppetvar, "rrd"],
- :logdir => [:puppetvar, "log"],
- :bucketdir => [:puppetvar, "bucket"],
- :statedir => [:puppetvar, "state"],
- :rundir => [:puppetvar, "run"],
-
- # then the files,
- :manifestdir => [:puppetconf, "manifests"],
- :manifest => [:manifestdir, "site.pp"],
- :localconfig => [:puppetconf, "localconfig"],
- :classfile => [:puppetconf, "classes.txt"],
- :logfile => [:logdir, "puppet.log"],
- :httplogfile => [:logdir, "http.log"],
- :masterlog => [:logdir, "puppetmaster.log"],
- :masterhttplog => [:logdir, "masterhttp.log"],
- :statefile => [:statedir, "state.yaml"],
- :checksumfile => [:statedir, "state.yaml"],
- :ssldir => [:puppetconf, "ssl"],
-
- # and finally the simple answers,
- :server => "puppet",
- :user => "puppet",
- :group => "puppet",
- :schedule => "puppet",
- :ignoreschedules => false,
- :rrdgraph => false,
- :noop => false,
- :parseonly => false,
- :puppetport => 8139,
- :masterport => 8140,
- :runinterval => 1800, # 30 minutes
- }
+ # Store a new default value.
+ def self.setdefaults(section, *arrays)
+ start = Time.now
+ @@config.setdefaults(section, *arrays)
+ end
# If we're running the standalone puppet process as a non-root user,
# use basedirs that are in the user's home directory.
- if @defaults[:name] == "puppet" and Process.uid != 0
- @defaults[:puppetconf] = File.expand_path("~/.puppet")
- @defaults[:puppetvar] = File.expand_path("~/.puppet/var")
+ conf = nil
+ var = nil
+ if self.name == "puppet" and Process.uid != 0
+ conf = File.expand_path("~/.puppet")
+ var = File.expand_path("~/.puppet/var")
else
# Else, use system-wide directories.
- @defaults[:puppetconf] = "/etc/puppet"
- @defaults[:puppetvar] = "/var/puppet"
+ conf = "/etc/puppet"
+ var = "/var/puppet"
end
+ self.setdefaults("puppet",
+ [:puppetconf, conf, "The main Puppet configuration directory."],
+ [:puppetvar, var, "Where Puppet stores dynamic and growing data."]
+ )
- def self.clear
- @@config = Hash.new(false)
- end
+ self.setdefaults("puppet",
+ [:logdir, "$puppetvar/log",
+ "The Puppet log directory."],
+ [:bucketdir, "$puppetvar/bucket",
+ "Where FileBucket files are stored."],
+ [:statedir, "$puppetvar/state",
+ "The directory where Puppet state is stored. Generally, this
+ directory can be removed without causing harm (although it might
+ result in spurious service restarts)."],
+ [:rundir, "$puppetvar/run", "Where Puppet PID files are kept."],
+ [:statefile, "$statedir/state.yaml",
+ "Where puppetd and puppetmasterd store state associated with the running
+ configuration. In the case of puppetmasterd, this file reflects the
+ state discovered through interacting with clients."],
+ [:ssldir, "$puppetconf/ssl", "Where SSL certificates are kept."]
+ )
+ self.setdefaults("puppetmasterd",
+ [:manifestdir, "$puppetconf/manifests",
+ "Where puppetmasterd looks for its manifests."],
+ [:manifest, "$manifestdir/site.pp",
+ "The entry-point manifest for puppetmasterd."],
+ [:masterlog, "$logdir/puppetmaster.log",
+ "Where puppetmasterd logs. This is generally not used, since syslog
+ is the default log destination."],
+ [:masterhttplog, "$logdir/masterhttp.log",
+ "Where the puppetmasterd web server logs."],
+ [:masterport, 8140, "Which port puppetmasterd listens on."],
+ [:parseonly, false, "Just check the syntax of the manifests."]
+ )
+
+ self.setdefaults("puppetd",
+ [:localconfig, "$puppetconf/localconfig",
+ "Where puppetd caches the local configuration. An extension reflecting
+ the cache format is added automatically."],
+ [:classfile, "$puppetconf/classes.txt",
+ "The file in which puppetd stores a list of the classes associated
+ with the retrieved configuratiion."],
+ [:puppetdlog, "$logdir/puppetd.log",
+ "The log file for puppetd. This is generally not used."],
+ [:httplogfile, "$logdir/http.log", "Where the puppetd web server logs."],
+ [:server, "puppet",
+ "The server to which server puppetd should connect"],
+ [:user, "puppet", "The user puppetmasterd should run as."],
+ [:group, "puppet", "The group puppetmasterd should run as."],
+ [:ignoreschedules, false,
+ "Boolean; whether puppetd should ignore schedules. This is useful
+ for initial puppetd runs."],
+ [:puppetport, 8139, "Which port puppetd listens on."],
+ [:noop, false, "Whether puppetd should be run in noop mode."],
+ [:runinterval, 1800, # 30 minutes
+ "How often puppetd applies the client configuration; in seconds"]
+ )
+ self.setdefaults("metrics",
+ [:rrddir, "$puppetvar/rrd",
+ "The directory where RRD database files are stored."],
+ [:rrdgraph, false, "Whether RRD information should be graphed."]
+ )
# configuration parameter access and stuff
def self.[](param)
- if param.is_a?(String)
- param = param.intern
- elsif ! param.is_a?(Symbol)
- raise ArgumentError, "Invalid parameter type %s" % param.class
- end
- case param
- when :debug:
- if Puppet::Log.level == :debug
- return true
- else
- return false
- end
- when :loglevel:
- return Puppet::Log.level
- else
- # allow manual override
- if @@config.include?(param)
- return @@config[param]
- else
- if @defaults.include?(param)
- default = @defaults[param]
- if default.is_a?(Proc)
- return default.call()
- elsif default.is_a?(Array)
- return File.join(self[default[0]], default[1])
- else
- return default
- end
- else
- raise ArgumentError, "Invalid parameter %s" % param
- end
- end
- end
+ @@config[param]
end
# configuration parameter access and stuff
@@ -183,6 +187,13 @@ module Puppet
end
end
+ def self.clear
+ @@config.clear
+ end
+
+ def self.config
+ @@config
+ end
# Start our event loop. This blocks, waiting for someone, somewhere,
# to generate events of some kind.
def self.start
@@ -207,33 +218,34 @@ module Puppet
end
# Store a new default value.
- def self.setdefault(param,value)
- if value.is_a?(Array)
- if value[0].is_a?(Symbol)
- unless @defaults.include?(value[0])
- raise ArgumentError, "Unknown basedir %s for param %s" %
- [value[0], param]
- end
- else
- raise ArgumentError, "Invalid default %s for param %s" %
- [value.inspect, param]
- end
-
- unless value[1].is_a?(String)
- raise ArgumentError, "Invalid default %s for param %s" %
- [value.inspect, param]
- end
-
- unless value.length == 2
- raise ArgumentError, "Invalid default %s for param %s" %
- [value.inspect, param]
- end
-
- @defaults[param] = value
- else
- @defaults[param] = value
- end
- end
+# def self.setdefaults(section, hash)
+# @@config.setdefaults(section, hash)
+# if value.is_a?(Array)
+# if value[0].is_a?(Symbol)
+# unless @defaults.include?(value[0])
+# raise ArgumentError, "Unknown basedir %s for param %s" %
+# [value[0], param]
+# end
+# else
+# raise ArgumentError, "Invalid default %s for param %s" %
+# [value.inspect, param]
+# end
+#
+# unless value[1].is_a?(String)
+# raise ArgumentError, "Invalid default %s for param %s" %
+# [value.inspect, param]
+# end
+#
+# unless value.length == 2
+# raise ArgumentError, "Invalid default %s for param %s" %
+# [value.inspect, param]
+# end
+#
+# @defaults[param] = value
+# else
+# @defaults[param] = value
+# end
+# end
# XXX this should all be done using puppet objects, not using
# normal mkdir
diff --git a/lib/puppet/client/master.rb b/lib/puppet/client/master.rb
index 29e466224..9ea24d502 100644
--- a/lib/puppet/client/master.rb
+++ b/lib/puppet/client/master.rb
@@ -85,9 +85,9 @@ class Puppet::Client::MasterClient < Puppet::Client
Puppet::Storage.init
Puppet::Storage.load
rescue => detail
- Puppet.err "Corrupt state file %s: %s" % [Puppet[:checksumfile], detail]
+ Puppet.err "Corrupt state file %s: %s" % [Puppet[:statefile], detail]
begin
- File.unlink(Puppet[:checksumfile])
+ File.unlink(Puppet[:statefile])
retry
rescue => detail
raise Puppet::Error.new("Cannot remove %s: %s" %
diff --git a/lib/puppet/config.rb b/lib/puppet/config.rb
index 84ebb6a55..295bf2035 100644
--- a/lib/puppet/config.rb
+++ b/lib/puppet/config.rb
@@ -1,6 +1,8 @@
module Puppet
# The class for handling configuration files.
class Config
+ include Enumerable
+
# Retrieve a config value
def [](param)
param = param.intern unless param.is_a? Symbol
@@ -18,7 +20,8 @@ class Config
def []=(param, value)
param = param.intern unless param.is_a? Symbol
unless @config.include?(param)
- @config[param] = newelement(param, value)
+ raise Puppet::Error, "Unknown configuration parameter %s" % param
+ #@config[param] = newelement(param, value)
end
unless @order.include?(param)
@order << param
@@ -26,6 +29,17 @@ class Config
@config[param].value = value
end
+ # A simplified equality operator.
+ def ==(other)
+ self.each { |myname, myobj|
+ unless other[myname] == myobj.value
+ return false
+ end
+ }
+
+ return true
+ end
+
# Remove all set values.
def clear
@config.each { |name, obj|
@@ -43,6 +57,22 @@ class Config
}
end
+ # Iterate over each section name.
+ def eachsection
+ yielded = []
+ @order.each { |name|
+ if @config.include?(name)
+ section = @config[name].section
+ unless yielded.include? section
+ yield section
+ yielded << section
+ end
+ else
+ raise Puppet::DevError, "%s is in the order but does not exist" % name
+ end
+ }
+ end
+
# Return an object by name.
def element(param)
param = param.intern unless param.is_a? Symbol
@@ -55,6 +85,15 @@ class Config
@config = {}
end
+ # Return all of the parameters associated with a given section.
+ def params(section)
+ @config.find_all { |name, obj|
+ obj.section == section
+ }.collect { |name, obj|
+ name
+ }
+ end
+
# Parse a configuration file.
def parse(file)
text = nil
@@ -76,7 +115,7 @@ class Config
}
section = "puppet"
- metas = %w{user group mode}
+ metas = %w{owner group mode}
values = Hash.new { |hash, key| hash[key] = {} }
text.split(/\n/).each { |line|
case line
@@ -115,18 +154,18 @@ class Config
# Create a new element. The value is passed in because it's used to determine
# what kind of element we're creating, but the value itself might be either
# a default or a value, so we can't actually assign it.
- def newelement(param, value)
+ def newelement(param, desc, value)
mod = nil
case value
when true, false, "true", "false":
mod = CBoolean
when /^\$/, /^\//:
mod = CFile
- when String: # nothing
+ when String, Integer, Float: # nothing
else
- raise Puppet::Error, "Invalid value '%s'" % value
+ raise Puppet::Error, "Invalid value '%s' for %s" % [value, param]
end
- element = CElement.new(param)
+ element = CElement.new(param, desc)
element.parent = self
if mod
element.extend(mod)
@@ -135,16 +174,78 @@ class Config
return element
end
+ def persection(section)
+ self.each { |name, obj|
+ if obj.section == section
+ yield obj
+ end
+ }
+ end
+
+ # Get a list of objects per section
+ def sectionlist
+ sectionlist = []
+ self.each { |name, obj|
+ section = obj.section || "puppet"
+ sections[section] ||= []
+ unless sectionlist.include?(section)
+ sectionlist << section
+ end
+ sections[section] << obj
+ }
+
+ return sectionlist, sections
+ end
+
+ # Convert a single section into transportable objects.
+ def section_to_transportable(section, done)
+ objects = []
+ persection(section) { |obj|
+ [:owner, :group].each { |type|
+ if obj.respond_to? type and val = obj.send(type)
+ # Skip owners and groups we've already done, but tag them with
+ # our section if necessary
+ if done[type].include?(val)
+ next unless defined? @section and @section
+
+ tags = done[type][val].tags
+ unless tags.include?(@section)
+ done[type][val].tags = tags << @section
+ end
+ else
+ newobj = TransObject.new(val, type.to_s)
+ newobj[:ensure] = "exists"
+ done[type] << newobj
+ end
+ end
+ }
+
+ if obj.respond_to? :to_transportable
+ objects << obj.to_transportable
+ end
+ }
+
+ bucket = Puppet::TransBucket.new
+ bucket.autoname = true
+ bucket.name = "autosection-%s" % bucket.object_id
+ bucket.type = section
+ bucket.push(*objects)
+ bucket.keyword = "class"
+
+ return bucket
+ end
+
# Set a bunch of defaults in a given section. The sections are actually pretty
# pointless, but they help break things up a bit, anyway.
- def setdefaults(section, hash)
+ def setdefaults(section, *defs)
section = section.intern unless section.is_a? Symbol
- hash.each { |param, value|
+ #hash.each { |param, value|
+ defs.each { |param, value, desc|
if @config.include?(param) and @config[param].default
raise Puppet::Error, "Default %s is already defined" % param
end
unless @config.include?(param)
- @config[param] = newelement(param, value)
+ @config[param] = newelement(param, desc, value)
end
@config[param].default = value
@config[param].section = section
@@ -155,35 +256,27 @@ class Config
def to_component
transport = self.to_transportable
return transport.to_type
-# comp = Puppet.type(:component).create(
-# :name => "PuppetConfig"
-# )
-# self.to_objects.each { |hash|
-# type = hash[:type]
-# hash.delete(:name)
-# comp.push Puppet.type(type).create(hash)
-# }
-#
-# return comp
+ end
+
+ # Convert our list of objects into a configuration file.
+ def to_config
+ str = ""
+ eachsection do |section|
+ str += "[#{section}]\n"
+ persection(section) do |obj|
+ str += obj.to_s + "\n"
+ end
+ end
+
+ return str
end
# Convert our configuration into a list of transportable objects.
def to_transportable
- objects = []
done = {
- :user => [],
+ :owner => [],
:group => [],
}
- sections = {}
- sectionlist = []
- self.each { |name, obj|
- section = obj.section || "puppet"
- sections[section] ||= []
- unless sectionlist.include?(section)
- sectionlist << section
- end
- sections[section] << obj
- }
topbucket = Puppet::TransBucket.new
if defined? @file and @file
@@ -194,69 +287,11 @@ class Config
topbucket.type = "puppetconfig"
topbucket.top = true
topbucket.autoname = true
- sectionlist.each { |section|
- objects = []
- sections[section].each { |obj|
- Puppet.notice "changing %s" % obj.name
- [:user, :group].each { |type|
- if obj.respond_to? type and val = obj.send(type)
- # Skip users and groups we've already done, but tag them with
- # our section if necessary
- if done[type].include?(val)
- next unless defined? @section and @section
-
- tags = done[type][val].tags
- unless tags.include?(@section)
- done[type][val].tags = tags << @section
- end
- else
- newobj = TransObject.new(val, type.to_s)
- newobj[:ensure] = "exists"
- done[type] << newobj
- end
- end
- }
- if obj.respond_to? :to_transportable
- objects << obj.to_transportable
- else
- Puppet.notice "%s is not transportable" % obj.name
- end
- }
-
- bucket = Puppet::TransBucket.new
- bucket.autoname = true
- bucket.name = "autosection-%s" % bucket.object_id
- bucket.type = section
- bucket.push(*objects)
- bucket.keyword = "class"
-
- topbucket.push bucket
- }
-# self.each { |name, obj|
-# [:user, :group].each { |type|
-# if obj.respond_to? type and val = obj.send(type)
-# # Skip users and groups we've already done, but tag them with
-# # our section if necessary
-# if done[type].include?(val)
-# next unless defined? @section and @section
-#
-# tags = done[type][val].tags
-# unless tags.include?(@section)
-# done[type][val].tags = tags << @section
-# end
-# else
-# obj = TransObject.new(val, type.to_s)
-# obj[:ensure] = "exists"
-# done[type] << obj
-# end
-# end
-# }
-#
-# if obj.respond_to? :to_transportable
-# objects << obj.to_transportable
-# end
-# }
+ # Now iterate over each section
+ eachsection do |section|
+ topbucket.push section_to_transportable(section, done)
+ end
topbucket
end
@@ -269,7 +304,7 @@ class Config
# The base element type.
class CElement
- attr_accessor :name, :section, :default, :parent
+ attr_accessor :name, :section, :default, :parent, :desc
# Unset any set value.
def clear
@@ -277,13 +312,19 @@ class Config
end
# Create the new element. Pretty much just sets the name.
- def initialize(name, value = nil)
+ def initialize(name, desc, value = nil)
@name = name
+ @desc = desc
if value
@value = value
end
end
+ def to_s
+ str = @desc.gsub(/^/, " # ") +
+ "\n %s = %s" % [@name, self.value]
+ end
+
# Retrieves the value, or if it's not set, retrieves the default.
def value
retval = nil
@@ -317,7 +358,7 @@ class Config
# A file.
module CFile
- attr_accessor :user, :group, :mode, :type
+ attr_accessor :owner, :group, :mode, :type
def convert(value)
unless value
@@ -351,10 +392,9 @@ class Config
end
def to_transportable
- Puppet.notice "transportabling %s" % self.name
obj = Puppet::TransObject.new(self.value, "file")
obj[:ensure] = self.type
- [:user, :group, :mode].each { |var|
+ [:owner, :group, :mode].each { |var|
if value = self.send(var)
obj[var] = value
end
diff --git a/lib/puppet/parser/ast.rb b/lib/puppet/parser/ast.rb
index c8cc74f04..5eb4ebaa2 100644
--- a/lib/puppet/parser/ast.rb
+++ b/lib/puppet/parser/ast.rb
@@ -11,8 +11,10 @@ module Puppet
# Do this so I don't have to type the full path in all of the subclasses
AST = Puppet::Parser::AST
- Puppet.setdefault(:typecheck, true)
- Puppet.setdefault(:paramcheck, true)
+ Puppet.setdefaults("ast",
+ [:typecheck, true, "Whether to validate types during parsing."],
+ [:paramcheck, true, "Whether to validate parameters during parsing."]
+ )
attr_accessor :line, :file, :parent
# Just used for 'tree', which is only used in debugging.
diff --git a/lib/puppet/parser/ast/objectdef.rb b/lib/puppet/parser/ast/objectdef.rb
index dc355be77..8b40bda71 100644
--- a/lib/puppet/parser/ast/objectdef.rb
+++ b/lib/puppet/parser/ast/objectdef.rb
@@ -221,7 +221,7 @@ class Puppet::Parser::AST
rescue => detail
raise Puppet::DevError, detail.to_s
end
- next if pname == "name" # always allow these
+ return if pname == "name" # always allow these
unless type.validattr?(pname)
error = Puppet::ParseError.new(
"Invalid parameter '%s' for type '%s'" %
diff --git a/lib/puppet/server/fileserver.rb b/lib/puppet/server/fileserver.rb
index 3349256ba..27e4d814a 100755
--- a/lib/puppet/server/fileserver.rb
+++ b/lib/puppet/server/fileserver.rb
@@ -8,7 +8,9 @@ class Server
class FileServer < Handler
attr_accessor :local
- Puppet.setdefault(:fileserverconfig, [:puppetconf, "fileserver.conf"])
+ Puppet.setdefaults("fileserver",
+ [:fileserverconfig, "$puppetconf/fileserver.conf",
+ "Where the fileserver configuration is stored."])
#CHECKPARAMS = %w{checksum type mode owner group}
CHECKPARAMS = [:mode, :type, :owner, :group, :checksum]
diff --git a/lib/puppet/sslcertificates/ca.rb b/lib/puppet/sslcertificates/ca.rb
index 0137e15eb..40b34e1ee 100644
--- a/lib/puppet/sslcertificates/ca.rb
+++ b/lib/puppet/sslcertificates/ca.rb
@@ -2,52 +2,77 @@ class Puppet::SSLCertificates::CA
Certificate = Puppet::SSLCertificates::Certificate
attr_accessor :keyfile, :file, :config, :dir, :cert
- @@params = [
- :certdir,
- :publickeydir,
- :privatekeydir,
- :cadir,
- :cakey,
- :cacert,
- :capass,
- :capub,
- :csrdir,
- :signeddir,
- :serial,
- :privatedir,
- :ca_crl_days,
- :ca_days,
- :ca_md,
- :req_bits,
- :keylength,
- :autosign
- ]
-
- @@defaults = {
- :certdir => [:ssldir, "certs"],
- :publickeydir => [:ssldir, "public_keys"],
- :privatekeydir => [:ssldir, "private_keys"],
- :cadir => [:ssldir, "ca"],
- :cacert => [:cadir, "ca_crt.pem"],
- :cakey => [:cadir, "ca_key.pem"],
- :capub => [:cadir, "ca_pub.pem"],
- :csrdir => [:cadir, "requests"],
- :signeddir => [:cadir, "signed"],
- :capass => [:cadir, "ca.pass"],
- :serial => [:cadir, "serial"],
- :privatedir => [:ssldir, "private"],
- :passfile => [:privatedir, "password"],
- :autosign => [:puppetconf, "autosign.conf"],
- :ca_crl_days => 365,
- :ca_days => 1825,
- :ca_md => "md5",
- :req_bits => 2048,
- :keylength => 1024,
- }
-
- @@params.each { |param|
- Puppet.setdefault(param,@@defaults[param])
- }
+# @@params = [
+# :certdir,
+# :publickeydir,
+# :privatekeydir,
+# :cadir,
+# :cakey,
+# :cacert,
+# :capass,
+# :capub,
+# :csrdir,
+# :signeddir,
+# :serial,
+# :privatedir,
+# :ca_crl_days,
+# :ca_days,
+# :ca_md,
+# :req_bits,
+# :keylength,
+# :autosign
+# ]
+# :certdir => [:ssldir, "certs"],
+# :publickeydir => [:ssldir, "public_keys"],
+# :privatekeydir => [:ssldir, "private_keys"],
+# :cadir => [:ssldir, "ca"],
+# :cacert => [:cadir, "ca_crt.pem"],
+# :cakey => [:cadir, "ca_key.pem"],
+# :capub => [:cadir, "ca_pub.pem"],
+# :csrdir => [:cadir, "requests"],
+# :signeddir => [:cadir, "signed"],
+# :capass => [:cadir, "ca.pass"],
+# :serial => [:cadir, "serial"],
+# :privatedir => [:ssldir, "private"],
+# :passfile => [:privatedir, "password"],
+# :autosign => [:puppetconf, "autosign.conf"],
+# :ca_crl_days => 365,
+# :ca_days => 1825,
+# :ca_md => "md5",
+# :req_bits => 2048,
+# :keylength => 1024,
+
+ Puppet.setdefaults("ca",
+ [:certdir, "$ssldir/certs", "The certificate directory."],
+ [:publickeydir, "$ssldir/public_keys", "The public key directory."],
+ [:privatekeydir, "$ssldir/private_keys", "The private key directory."],
+ [:cadir, "$ssldir/ca",
+ "The root directory for the certificate authority."],
+ [:cacert, "$cadir/ca_crt.pem", "The CA certificate."],
+ [:cakey, "$cadir/ca_key.pem", "The CA private key."],
+ [:capub, "$cadir/ca_pub.pem", "The CA public key."],
+ [:csrdir, "$cadir/requests",
+ "Where the CA stores certificate requests"],
+ [:signeddir, "$cadir/signed",
+ "Where the CA stores signed certificates."],
+ [:capass, "$cadir/ca.pass",
+ "Where the CA stores the password for the private key; usually not used."],
+ [:serial, "$cadir/serial",
+ "Where the serial number for certificates is stored."],
+ [:passfile, "$privatedir/password",
+ "Where puppetd stores the password for its private key. Generally
+ unused."],
+ [:autosign, "$puppetconf/autosign.conf",
+ "Where to look for the autosigning configuration file."],
+ [:ca_days, 1825, "How long a certificate should be valid."],
+ [:ca_md, "md5", "The type of hash used in certificates."],
+ [:req_bits, 2048, "The bit length of the certificates."],
+ [:keylength, 1024, "The bit length of keys."]
+ )
+
+ #@@params.each { |param|
+ # Puppet.setdefault(param,@@defaults[param])
+ #}
def certfile
@config[:cacert]
@@ -161,7 +186,7 @@ class Puppet::SSLCertificates::CA
def setconfig(hash)
@config = {}
- @@params.each { |param|
+ Puppet.config.params("ca").each { |param|
if hash.include?(param)
begin
@config[param] = hash[param]
diff --git a/lib/puppet/transportable.rb b/lib/puppet/transportable.rb
index 405179808..128a06a84 100644
--- a/lib/puppet/transportable.rb
+++ b/lib/puppet/transportable.rb
@@ -140,7 +140,6 @@ module Puppet
str = "#{@keyword} #{@type} {\n%s\n}"
end
str % @children.collect { |child|
- Puppet.info "manifesting %s" % child.name
child.to_manifest
}.collect { |str|
if self.top