summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/type.rb20
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index c061380bd..135b3b427 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
@@ -201,7 +201,7 @@ class Type < Puppet::Element
if @objects.has_key?(name) and self.isomorphic?
raise Puppet::Error.new(
"Object '%s' of type '%s' already exists with id '%s' vs. '%s'" %
- [name,newobj.class.name,
+ [name, newobj.class.name,
@objects[name].object_id,newobj.object_id]
)
else
@@ -353,6 +353,10 @@ class Type < Puppet::Element
@@metaparams.each { |p| @@metaparamhash[name] = p }
end
+ def self.eachmetaparam
+ @@metaparams.each { |p| yield p.name }
+ end
+
# Create a new parameter. Requires a block and a name, stores it in the
# @parameters array, and does some basic checking on it.
def self.newparam(name, &block)
@@ -1480,10 +1484,10 @@ class Type < Puppet::Element
# Documentation methods
def self.paramdoc(param)
- @paramdoc[param]
+ @paramhash[param].doc
end
def self.metaparamdoc(metaparam)
- @@metaparamdoc[metaparam]
+ @@metaparamhash[metaparam].doc
end
# Add all of the meta parameters.
@@ -1592,12 +1596,20 @@ class Type < Puppet::Element
you are creating long commands using exec or when many different systems
call a given package different names."
- munge do |*aliases|
+ munge do |aliases|
unless aliases.is_a?(Array)
aliases = [aliases]
end
@parent.info "Adding aliases %s" % aliases.join(", ")
aliases.each do |other|
+ if obj = @parent.class[other]
+ unless obj == @parent
+ raise Puppet::Error,
+ "%s an not create alias %s: object already exists" %
+ [@parent.name, other]
+ end
+ next
+ end
@parent.class[other] = @parent
end
end