summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet.rb2
-rw-r--r--lib/puppet/client/master.rb1
-rw-r--r--lib/puppet/config.rb53
-rw-r--r--lib/puppet/type.rb2
4 files changed, 55 insertions, 3 deletions
diff --git a/lib/puppet.rb b/lib/puppet.rb
index d48d45b94..1526b3c4b 100644
--- a/lib/puppet.rb
+++ b/lib/puppet.rb
@@ -13,7 +13,7 @@ require 'puppet/util'
#
# it's also a place to find top-level commands like 'debug'
module Puppet
-PUPPETVERSION = '0.11.2'
+ PUPPETVERSION = '0.12.0'
def Puppet.version
return PUPPETVERSION
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,