diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-01-25 23:12:21 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-01-25 23:12:21 +0000 |
commit | 87904d3728546ef5d32f80191bdc0c2814ee88ab (patch) | |
tree | e337836874f126fd8d4ffc2240c1241f11ba5afd /lib/puppet | |
parent | 9b2afcb4c32ceeac6e008cd2ec171a2b7bdc37ec (diff) | |
download | puppet-87904d3728546ef5d32f80191bdc0c2814ee88ab.tar.gz puppet-87904d3728546ef5d32f80191bdc0c2814ee88ab.tar.xz puppet-87904d3728546ef5d32f80191bdc0c2814ee88ab.zip |
RPM release is almost entirely there, it just needs to be integrated into release management
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@850 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/client/master.rb | 1 | ||||
-rw-r--r-- | lib/puppet/config.rb | 53 | ||||
-rw-r--r-- | lib/puppet/type.rb | 2 |
3 files changed, 54 insertions, 2 deletions
diff --git a/lib/puppet/client/master.rb b/lib/puppet/client/master.rb index 73217b2f0..29e466224 100644 --- a/lib/puppet/client/master.rb +++ b/lib/puppet/client/master.rb @@ -54,6 +54,7 @@ class Puppet::Client::MasterClient < Puppet::Client Metric.store Metric.graph end + Puppet.notice "Finished configuration run" return transaction end diff --git a/lib/puppet/config.rb b/lib/puppet/config.rb index dc9892cfb..833a2c6e3 100644 --- a/lib/puppet/config.rb +++ b/lib/puppet/config.rb @@ -1,6 +1,6 @@ module Puppet # The class for handling configuration files. -class Config < Hash +class Config # Slight override, since we can't seem to have a subclass where all instances # have the same default block. def [](section) @@ -43,6 +43,57 @@ class Config < Hash end } end + + def setdefaults(hash) + hash.each { |param, value| + if @defaults.include?(param) + raise Puppet::Error, "Default %s is already defined" % param + end + + case value + when true, false: + @defaults[param] = Boolean.new(param, value) + when String: + @defaults[param] = Element.new(param, value) + when Hash: + type = nil + unless value.include?(:type) + raise Puppet::Error, "You must include the object type" + end + unless type = Puppet.type(value[:type]) + raise Puppet::Error, "Invalid type %s" % value[:type] + end + + value.delete(:type) + + # FIXME this won't work, because we don't want to interpolate the + # file name until they actually ask for it + begin + @defaults[param] = type.create(value) + rescue => detail + raise Puppet::Error, "Could not create default %s: %s" % + [param, detail] + end + end + } + end + + class Element + attr_accessor :name, :value + end + + class File < Element + end + + class Boolean < Element + def value=(value) + unless value == true or value == false + raise Puppet::DevError, "Invalid value %s for %s" % [value, @name] + end + + @value = value + end + end end end diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index 424646742..151233862 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -1849,7 +1849,7 @@ class Type < Puppet::Element newmetaparam(:schedule) do desc "On what schedule the object should be managed. You must create a schedule_ object, and then reference the name of that object to use - that for your schedule: + that for your schedule:: schedule { daily: period => daily, |