summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util/selinux.rb
diff options
context:
space:
mode:
authorSean E. Millichamp <sean@bruenor.org>2008-10-07 22:46:02 -0400
committerJames Turnbull <james@lovedthanlost.net>2008-10-08 14:01:24 +1100
commit996ac469b3013e4bcda8bc2f3bcb49ef57740a1f (patch)
tree000ef59481b0f9ae9a6304c5ed012bdca2c578d7 /lib/puppet/util/selinux.rb
parentd803096c9a69e0c15548d1ab0d9136c7de234d07 (diff)
downloadpuppet-996ac469b3013e4bcda8bc2f3bcb49ef57740a1f.tar.gz
puppet-996ac469b3013e4bcda8bc2f3bcb49ef57740a1f.tar.xz
puppet-996ac469b3013e4bcda8bc2f3bcb49ef57740a1f.zip
Fix scenario when SELinux support tools exist, but SELinux is disabled
Diffstat (limited to 'lib/puppet/util/selinux.rb')
-rw-r--r--lib/puppet/util/selinux.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/puppet/util/selinux.rb b/lib/puppet/util/selinux.rb
index c25773344..e99ee30e2 100644
--- a/lib/puppet/util/selinux.rb
+++ b/lib/puppet/util/selinux.rb
@@ -34,6 +34,9 @@ module Puppet::Util::SELinux
# Note: For this command to work a full, non-relative, filesystem path
# should be given.
def get_selinux_default_context(file)
+ unless selinux_support?
+ return nil
+ end
unless FileTest.executable?("/usr/sbin/matchpathcon")
return nil
end
@@ -73,6 +76,9 @@ module Puppet::Util::SELinux
# only a single component or update the entire context. It is just a
# wrapper around the chcon command.
def set_selinux_context(file, value, component = false)
+ unless selinux_support?
+ return nil
+ end
case component
when :seluser
flag = "-u"