summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/puppet/module.rb2
-rwxr-xr-xspec/unit/module.rb6
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/puppet/module.rb b/lib/puppet/module.rb
index 9385812b1..7bf35ac18 100644
--- a/lib/puppet/module.rb
+++ b/lib/puppet/module.rb
@@ -24,7 +24,7 @@ class Puppet::Module
def self.templatepath(environment = nil)
dirs = Puppet.settings.value(:templatedir, environment).split(":")
dirs.select do |p|
- p =~ /^#{File::SEPARATOR}/ && File::directory?(p)
+ File::directory?(p)
end
end
diff --git a/spec/unit/module.rb b/spec/unit/module.rb
index a6608fc1b..1deaec232 100755
--- a/spec/unit/module.rb
+++ b/spec/unit/module.rb
@@ -114,6 +114,12 @@ describe Puppet::Module, " when searching for templates" do
Puppet::Module.find_template("mytemplate").should == "/my/templates/mytemplate"
end
+ it "should accept relative templatedirs" do
+ Puppet[:templatedir] = "my/templates"
+ File.expects(:directory?).with(File.join(Dir.getwd,"my/templates")).returns(true)
+ Puppet::Module.find_template("mytemplate").should == File.join(Dir.getwd,"my/templates/mytemplate")
+ end
+
it "should use the environment templatedir if no module is found and an environment is specified" do
Puppet::Module.stubs(:templatepath).with("myenv").returns(["/myenv/templates"])
Puppet::Module.expects(:find).with("mymod", "myenv").returns(nil)