summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2009-11-24 19:34:15 -0800
committerJames Turnbull <james@lovedthanlost.net>2009-11-26 07:41:43 +1100
commit41da96281f6c8902191b2c6cc8e07e31363d8f45 (patch)
tree7f8deeb56d419acc500cb18cc0d61d02abb9f9a1 /spec
parentc9f40be6c567d8de328b9d79dde357672323925a (diff)
downloadpuppet-41da96281f6c8902191b2c6cc8e07e31363d8f45.tar.gz
puppet-41da96281f6c8902191b2c6cc8e07e31363d8f45.tar.xz
puppet-41da96281f6c8902191b2c6cc8e07e31363d8f45.zip
Feature 2827 Option to disable managing internal files
Add a flag "manage_internal_file_permissions" which is enabled by default. Disabling this flag prevents Puppet from managing the owner, group, or mode of files created from Puppet::Util::Settings::FileSetting I think this is a wide enough net to follow Luke's suggestion of "disable management of everything", and it certainly satisfies the requests I'm aware of, but if I've missed anything, let me know. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/util/settings/file_setting.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/unit/util/settings/file_setting.rb b/spec/unit/util/settings/file_setting.rb
index 74d68fb7d..dfe4d25d0 100755
--- a/spec/unit/util/settings/file_setting.rb
+++ b/spec/unit/util/settings/file_setting.rb
@@ -169,18 +169,43 @@ describe Puppet::Util::Settings::FileSetting do
@file.to_resource[:mode].should == 0755
end
+ it "should not set the mode on a the file if manage_internal_file_permissions is disabled" do
+ Puppet[:manage_internal_file_permissions] = false
+
+ @file.stubs(:mode).returns(0755)
+
+ @file.to_resource[:mode].should == nil
+ end
+
it "should set the owner if running as root and the owner is provided" do
Puppet.features.expects(:root?).returns true
@file.stubs(:owner).returns "foo"
@file.to_resource[:owner].should == "foo"
end
+ it "should not set the owner if manage_internal_file_permissions is disabled" do
+ Puppet[:manage_internal_file_permissions] = false
+ Puppet.features.stubs(:root?).returns true
+ @file.stubs(:owner).returns "foo"
+
+ @file.to_resource[:owner].should == nil
+ end
+
it "should set the group if running as root and the group is provided" do
Puppet.features.expects(:root?).returns true
@file.stubs(:group).returns "foo"
@file.to_resource[:group].should == "foo"
end
+ it "should not set the group if manage_internal_file_permissions is disabled" do
+ Puppet[:manage_internal_file_permissions] = false
+ Puppet.features.stubs(:root?).returns true
+ @file.stubs(:group).returns "foo"
+
+ @file.to_resource[:group].should == nil
+ end
+
+
it "should not set owner if not running as root" do
Puppet.features.expects(:root?).returns false
@file.stubs(:owner).returns "foo"