summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/puppet/util/settings/file_setting.rb3
-rwxr-xr-xspec/unit/util/settings/file_setting_spec.rb22
2 files changed, 24 insertions, 1 deletions
diff --git a/lib/puppet/util/settings/file_setting.rb b/lib/puppet/util/settings/file_setting.rb
index 0fa65d846..f02a0c547 100644
--- a/lib/puppet/util/settings/file_setting.rb
+++ b/lib/puppet/util/settings/file_setting.rb
@@ -93,7 +93,8 @@ class Puppet::Util::Settings::FileSetting < Puppet::Util::Settings::Setting
if Puppet[:manage_internal_file_permissions]
resource[:mode] = self.mode if self.mode
- if Puppet.features.root?
+ # REMIND fails on Windows because chown/chgrp functionality not supported yet
+ if Puppet.features.root? and !Puppet.features.microsoft_windows?
resource[:owner] = self.owner if self.owner
resource[:group] = self.group if self.group
end
diff --git a/spec/unit/util/settings/file_setting_spec.rb b/spec/unit/util/settings/file_setting_spec.rb
index 01d891f08..6344cf1b5 100755
--- a/spec/unit/util/settings/file_setting_spec.rb
+++ b/spec/unit/util/settings/file_setting_spec.rb
@@ -189,6 +189,8 @@ describe Puppet::Util::Settings::FileSetting do
it "should set the owner if running as root and the owner is provided" do
Puppet.features.expects(:root?).returns true
+ Puppet.features.stubs(:microsoft_windows?).returns false
+
@file.stubs(:owner).returns "foo"
@file.to_resource[:owner].should == "foo"
end
@@ -203,6 +205,8 @@ describe Puppet::Util::Settings::FileSetting do
it "should set the group if running as root and the group is provided" do
Puppet.features.expects(:root?).returns true
+ Puppet.features.stubs(:microsoft_windows?).returns false
+
@file.stubs(:group).returns "foo"
@file.to_resource[:group].should == "foo"
end
@@ -218,16 +222,34 @@ describe Puppet::Util::Settings::FileSetting do
it "should not set owner if not running as root" do
Puppet.features.expects(:root?).returns false
+ Puppet.features.stubs(:microsoft_windows?).returns false
@file.stubs(:owner).returns "foo"
@file.to_resource[:owner].should be_nil
end
it "should not set group if not running as root" do
Puppet.features.expects(:root?).returns false
+ Puppet.features.stubs(:microsoft_windows?).returns false
@file.stubs(:group).returns "foo"
@file.to_resource[:group].should be_nil
end
+ describe "on Microsoft Windows systems" do
+ before :each do
+ Puppet.features.stubs(:microsoft_windows?).returns true
+ end
+
+ it "should not set owner" do
+ @file.stubs(:owner).returns "foo"
+ @file.to_resource[:owner].should be_nil
+ end
+
+ it "should not set group" do
+ @file.stubs(:group).returns "foo"
+ @file.to_resource[:group].should be_nil
+ end
+ end
+
it "should set :ensure to the file type" do
@file.expects(:type).returns :directory
@file.to_resource[:ensure].should == :directory