diff options
author | Paul Berry <paul@puppetlabs.com> | 2010-07-27 11:34:32 -0700 |
---|---|---|
committer | markus <markus@AVA-351181.(none)> | 2010-08-03 15:19:31 -0700 |
commit | 00ebf01227745edc84084d10a9d8be7439551b0f (patch) | |
tree | 5e334b8f01f4091bd1e25fa2b36731bf4a800bfd /spec | |
parent | e32320ee2c65275e3c695c555f506a499209efa1 (diff) | |
download | puppet-00ebf01227745edc84084d10a9d8be7439551b0f.tar.gz puppet-00ebf01227745edc84084d10a9d8be7439551b0f.tar.xz puppet-00ebf01227745edc84084d10a9d8be7439551b0f.zip |
[#4344] Fix for failing templates when module name matches file in local dir.
When the name of a module matches the name of a file in the local
directory, puppet agent would sometimes try to read that file and
interpret it as puppet code. This happened because files.rb was
unintentionally permitting puppet files without an extension. Fixed
by changing the glob pattern to only permit ".pp" and ".rb"
extensions.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/parser/files_spec.rb | 6 | ||||
-rw-r--r-- | spec/unit/parser/type_loader_spec.rb | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/spec/unit/parser/files_spec.rb b/spec/unit/parser/files_spec.rb index fcfbfa613..3eb0db07e 100644 --- a/spec/unit/parser/files_spec.rb +++ b/spec/unit/parser/files_spec.rb @@ -154,7 +154,7 @@ describe Puppet::Parser::Files do it "should match against provided fully qualified patterns" do pattern = @basepath + "/fully/qualified/pattern/*" - Dir.expects(:glob).with(pattern+'{,.pp,.rb}').returns(%w{my file list}) + Dir.expects(:glob).with(pattern+'{.pp,.rb}').returns(%w{my file list}) Puppet::Parser::Files.find_manifests(pattern)[1].should == %w{my file list} end @@ -168,7 +168,7 @@ describe Puppet::Parser::Files do pattern = @basepath + "/fully/qualified/pattern/*" file = @basepath + "/my/file" dir = @basepath + "/my/directory" - Dir.expects(:glob).with(pattern+'{,.pp,.rb}').returns([file, dir]) + Dir.expects(:glob).with(pattern+'{.pp,.rb}').returns([file, dir]) FileTest.expects(:directory?).with(file).returns(false) FileTest.expects(:directory?).with(dir).returns(true) Puppet::Parser::Files.find_manifests(pattern)[1].should == [file] @@ -176,7 +176,7 @@ describe Puppet::Parser::Files do it "should return files once only" do pattern = @basepath + "/fully/qualified/pattern/*" - Dir.expects(:glob).with(pattern+'{,.pp,.rb}').returns(%w{one two one}) + Dir.expects(:glob).with(pattern+'{.pp,.rb}').returns(%w{one two one}) Puppet::Parser::Files.find_manifests(pattern)[1].should == %w{one two} end end diff --git a/spec/unit/parser/type_loader_spec.rb b/spec/unit/parser/type_loader_spec.rb index 8f005d551..83006b37b 100644 --- a/spec/unit/parser/type_loader_spec.rb +++ b/spec/unit/parser/type_loader_spec.rb @@ -192,7 +192,7 @@ describe Puppet::Parser::TypeLoader do end it "should be able to add classes to the current resource type collection" do - file = tmpfile("simple_file") + file = tmpfile("simple_file.pp") File.open(file, "w") { |f| f.puts "class foo {}" } @loader.import(file) |