summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-07-11 20:40:53 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-07-11 20:40:53 +0000
commit1ab45947dab40a99c331a5dc550dc00f54dc3180 (patch)
treebd1a9bc223a1d44dbb2dfb5a92a894c8e8e0abc1 /lib
parenta6cc3e473fd68bbb7493a81c14fa1a607d88a5a3 (diff)
downloadpuppet-1ab45947dab40a99c331a5dc550dc00f54dc3180.tar.gz
puppet-1ab45947dab40a99c331a5dc550dc00f54dc3180.tar.xz
puppet-1ab45947dab40a99c331a5dc550dc00f54dc3180.zip
Adding tests for previous config bugfixes, and updating changelog
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1391 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/config.rb39
1 files changed, 25 insertions, 14 deletions
diff --git a/lib/puppet/config.rb b/lib/puppet/config.rb
index e4dfe9086..701ee5942 100644
--- a/lib/puppet/config.rb
+++ b/lib/puppet/config.rb
@@ -19,7 +19,7 @@ class Config
return val
end
else
- raise ArgumentError, "Invalid argument %s" % param
+ raise ArgumentError, "Undefined configuration parameter '%s'" % param
end
end
@@ -104,15 +104,6 @@ class Config
@used = []
end
- def symbolize(param)
- case param
- when String: return param.intern
- when Symbol: return param
- else
- raise ArgumentError, "Invalid param type %s" % param.class
- end
- end
-
def each
@order.each { |name|
if @config.include?(name)
@@ -170,6 +161,11 @@ class Config
end
end
+ def include?(name)
+ name = name.intern if name.is_a? String
+ @config.include?(name)
+ end
+
# Create a new config object
def initialize
@order = []
@@ -306,8 +302,8 @@ class Config
else
raise Puppet::Error, "Invalid value '%s' for %s" % [value.inspect, hash[:name]]
end
+ hash[:parent] = self
element = klass.new(hash)
- element.parent = self
@order << element.name
@@ -421,6 +417,15 @@ class Config
}
end
+ def symbolize(param)
+ case param
+ when String: return param.intern
+ when Symbol: return param
+ else
+ raise ArgumentError, "Invalid param type %s" % param.class
+ end
+ end
+
# Convert our list of objects into a component that can be applied.
def to_component
transport = self.to_transportable
@@ -656,6 +661,10 @@ Generated on #{Time.now}.
# Create the new element. Pretty much just sets the name.
def initialize(args = {})
+ if args.include?(:parent)
+ self.parent = args[:parent]
+ args.delete(:parent)
+ end
args.each do |param, value|
method = param.to_s + "="
unless self.respond_to? method
@@ -834,9 +843,11 @@ Generated on #{Time.now}.
def validate(value)
return true unless value.is_a? String
value.scan(/\$(\w+)/) { |name|
- name = name[0]
- unless @parent[name]
- raise Puppet::Error, "'%s' is unset" % name
+ name = $1
+ unless @parent.include?(name)
+ raise ArgumentError,
+ "Configuration parameter '%s' is undefined" %
+ name
end
}
end