summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/puppet/type.rb6
-rw-r--r--lib/puppet/type/component.rb17
-rw-r--r--lib/puppet/type/pfile.rb3
-rw-r--r--test/types/tc_basic.rb13
4 files changed, 31 insertions, 8 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
diff --git a/test/types/tc_basic.rb b/test/types/tc_basic.rb
index cd567855c..d3519a9be 100644
--- a/test/types/tc_basic.rb
+++ b/test/types/tc_basic.rb
@@ -21,7 +21,10 @@ class TestBasic < Test::Unit::TestCase
Puppet[:loglevel] = :debug if __FILE__ == $0
assert_nothing_raised() {
- @component = Puppet::Component.new(:name => "yaytest")
+ @component = Puppet::Component.new(
+ :name => "yaytest",
+ :type => "testing"
+ )
}
assert_nothing_raised() {
@@ -107,4 +110,12 @@ class TestBasic < Test::Unit::TestCase
transaction.evaluate
}
end
+
+ def test_paths
+ [@configfile,@sleeper,@component].each { |obj|
+ assert_nothing_raised {
+ assert(obj.path.is_a?(Array))
+ }
+ }
+ end
end