summaryrefslogtreecommitdiffstats
path: root/spec/unit
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2009-11-23 17:40:03 -0800
committerJames Turnbull <james@lovedthanlost.net>2009-11-25 09:01:19 +1100
commitdc8812c371810aa1d3c723d8b42b9773d1ded851 (patch)
tree07ff7df47c142ef1ccd166962e2c2de1a95c42fa /spec/unit
parent57632a0497183b2ec205b83eea939c3159e44925 (diff)
downloadpuppet-dc8812c371810aa1d3c723d8b42b9773d1ded851.tar.gz
puppet-dc8812c371810aa1d3c723d8b42b9773d1ded851.tar.xz
puppet-dc8812c371810aa1d3c723d8b42b9773d1ded851.zip
Fixing 2792 selinux tries to set properties on unsupported filesystes
Check that a specific file supports selinux properties before trying to set them. This patch is functionally identical to the one Darrell Fuhriman submitted with the bug report. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
Diffstat (limited to 'spec/unit')
-rwxr-xr-xspec/unit/util/selinux.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/unit/util/selinux.rb b/spec/unit/util/selinux.rb
index da4686ec4..2a9a4182e 100755
--- a/spec/unit/util/selinux.rb
+++ b/spec/unit/util/selinux.rb
@@ -158,6 +158,12 @@ describe Puppet::Util::SELinux do
set_selinux_context("/foo", "user_u:role_r:type_t:s0").should be_nil
end
+ it "should return nil if selinux_label_support returns false" do
+ self.expects(:selinux_support?).returns true
+ self.expects(:selinux_label_support?).with("/foo").returns false
+ set_selinux_context("/foo", "user_u:role_r:type_t:s0").should be_nil
+ end
+
it "should use lsetfilecon to set a context" do
self.expects(:selinux_support?).returns true
Selinux.expects(:lsetfilecon).with("/foo", "user_u:role_r:type_t:s0").returns 0