summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Cooper <josh@puppetlabs.com>2011-08-22 09:26:33 -0700
committerJosh Cooper <josh@puppetlabs.com>2011-08-22 15:07:41 -0700
commit0f207a8ea61205ba6b47e8da429ab3887b3cda4d (patch)
tree3dabcf04843f4c4faf4cc35bcdbb3384ee461c73
parent47058abc0c5647d59b0dd21181e67dbfdd908292 (diff)
downloadpuppet-0f207a8ea61205ba6b47e8da429ab3887b3cda4d.tar.gz
puppet-0f207a8ea61205ba6b47e8da429ab3887b3cda4d.tar.xz
puppet-0f207a8ea61205ba6b47e8da429ab3887b3cda4d.zip
(#8662) Don't manage internal file permissions on Windows
When running as root, puppet will by default manage internal file permissions for file-related settings. However, ruby does not support chown/chgrp functionality on Windows, so puppet will fail to run (puppet apply generates an exception while trying to set the owner, etc). This commit disables internal file permissions handling on Windows until we add support for chown (at least) as part of the larger file type effort on Windows.
-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