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 <[email protected]>
Signed-off-by: Jacob Helwig <[email protected]>
---
 spec/integration/type/file_spec.rb |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/spec/integration/type/file_spec.rb 
b/spec/integration/type/file_spec.rb
index c900b46..9814c45 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
-- 
1.7.6

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to