diff options
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/type.rb | 6 | ||||
-rw-r--r-- | lib/puppet/type/component.rb | 17 | ||||
-rw-r--r-- | lib/puppet/type/pfile.rb | 3 |
3 files changed, 19 insertions, 7 deletions
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index 5072a0860..79402c94e 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -615,7 +615,11 @@ class Type < Puppet::Element # return the full path to us, for logging and rollback # some classes (e.g., FileTypeRecords) will have to override this def path - return [self.class, self.name].flatten + if defined? @parent + return [@parent.name, self.name].flatten + else + return [self.name] + end end #--------------------------------------------------------------- diff --git a/lib/puppet/type/component.rb b/lib/puppet/type/component.rb index c3ba3fadf..bb7b57433 100644 --- a/lib/puppet/type/component.rb +++ b/lib/puppet/type/component.rb @@ -38,8 +38,13 @@ Component def initialize(args) @children = [] + + # it makes sense to have a more reasonable default here than 'false' + unless args.include?(:type) or args.include?("type") + args[:type] = "component" + end super(args) - debug "Made component with name %s" % self.name + debug "Made component with name %s and type %s" % [self.name, self[:type]] end # just turn the container into a transaction @@ -49,6 +54,11 @@ Component return transaction end + def name + return self[:name] + #return "%s[%s]" % [self[:type],self[:name]] + end + def push(*ary) ary.each { |child| unless child.is_a?(Puppet::Element) @@ -56,13 +66,10 @@ Component raise "Containers can only contain Puppet::Elements" end @children.push child + child.parent = self } end - def name - return "%s[%s]" % [@parameters[:type],@parameters[:name]] - end - def refresh @children.collect { |child| if child.respond_to?(:refresh) diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb index e8f50e74b..1db63f8fd 100644 --- a/lib/puppet/type/pfile.rb +++ b/lib/puppet/type/pfile.rb @@ -213,7 +213,8 @@ module Puppet # unless we're fully qualified or we've specifically allowed # relative links. Relative links are currently disabled, until # someone actually asks for them - unless @should =~ /^\// or self.parent[:relativelinks] + #unless @should =~ /^\// or self.parent[:relativelinks] + unless @should =~ /^\// @should = File.expand_path @should end end |