diff options
| author | Josh Cooper <josh@puppetlabs.com> | 2011-08-22 09:26:33 -0700 |
|---|---|---|
| committer | Josh Cooper <josh@puppetlabs.com> | 2011-08-22 15:07:41 -0700 |
| commit | 0f207a8ea61205ba6b47e8da429ab3887b3cda4d (patch) | |
| tree | 3dabcf04843f4c4faf4cc35bcdbb3384ee461c73 /spec/unit/util/settings | |
| parent | 47058abc0c5647d59b0dd21181e67dbfdd908292 (diff) | |
| download | puppet-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.
Diffstat (limited to 'spec/unit/util/settings')
| -rwxr-xr-x | spec/unit/util/settings/file_setting_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
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 |
