summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Helwig <jacob@puppetlabs.com>2011-08-02 12:19:47 -0700
committerJacob Helwig <jacob@puppetlabs.com>2011-08-19 13:52:58 -0700
commita0013e4b2d802f7d10e913da9b89ea912b1564bd (patch)
tree24260ef5bd939d1b202aa0269fe540630b216f98
parent58c7dacef62679c9e2ec5fd889d224978ed8c0d6 (diff)
downloadpuppet-a0013e4b2d802f7d10e913da9b89ea912b1564bd.tar.gz
puppet-a0013e4b2d802f7d10e913da9b89ea912b1564bd.tar.xz
puppet-a0013e4b2d802f7d10e913da9b89ea912b1564bd.zip
Check for the appropriate permissions in File type tests on Windows
Ruby's interface to the permissions on Windows does not map well to the *nix concept of User, Group, and Other. On Windows directories don't get the execute bit, and Ruby cannot manage group, and other via the standard chmod interfaces. Because of this, we no longer check that the execute bit is set on Windows, and use a permission set that will show differences if we fail to set the permissions on Windows. Reviewed-by: Nick Lewis <nick@puppetlabs.com> (cherry picked from commit 447c1171845d8d17e4e684c9508fddecc003d15e)
-rwxr-xr-xspec/integration/type/file_spec.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/spec/integration/type/file_spec.rb b/spec/integration/type/file_spec.rb
index c900b46b7..9814c4539 100755
--- a/spec/integration/type/file_spec.rb
+++ b/spec/integration/type/file_spec.rb
@@ -289,23 +289,24 @@ describe Puppet::Type.type(:file) do
(File.stat(file).mode & 007777).should == 0644
end
- it "should recursively manage files even if there is an explicit file whose name is a prefix of the managed file", :fails_on_windows => true do
+ it "should recursively manage files even if there is an explicit file whose name is a prefix of the managed file" do
dir = tmpfile("recursion_vs_explicit_2")
- managed = File.join(dir, "file")
- generated = File.join(dir, "file_with_a_name_starting_with_the_word_file")
+ managed = File.join(dir, "file")
+ generated = File.join(dir, "file_with_a_name_starting_with_the_word_file")
+ managed_mode = Puppet.features.microsoft_windows? ? 0444 : 0700
FileUtils.mkdir_p(dir)
File.open(managed, "w") { |f| f.puts "" }
File.open(generated, "w") { |f| f.puts "" }
@catalog = Puppet::Resource::Catalog.new
- @catalog.add_resource Puppet::Type::File.new(:name => dir, :recurse => true, :backup => false, :mode => "755")
+ @catalog.add_resource Puppet::Type::File.new(:name => dir, :recurse => true, :backup => false, :mode => managed_mode)
@catalog.add_resource Puppet::Type::File.new(:name => managed, :recurse => true, :backup => false, :mode => "644")
@catalog.apply
- (File.stat(generated).mode & 007777).should == 0755
+ (File.stat(generated).mode & 007777).should == managed_mode
end
end
@@ -381,8 +382,9 @@ describe Puppet::Type.type(:file) do
catalog.apply
+ expected_mode = Puppet.features.microsoft_windows? ? 0644 : 0755
File.read(dest).should == "foo"
- (File.stat(dest).mode & 007777).should == 0755
+ (File.stat(dest).mode & 007777).should == expected_mode
end
it "should be able to copy individual files even if recurse has been specified" do