summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/util')
-rw-r--r--lib/puppet/util/selinux.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/puppet/util/selinux.rb b/lib/puppet/util/selinux.rb
index 0a4af3ca1..148748950 100644
--- a/lib/puppet/util/selinux.rb
+++ b/lib/puppet/util/selinux.rb
@@ -6,8 +6,12 @@
# are available. At this time (2008-09-26) these bindings aren't bundled on
# any SELinux-using distribution I know of.
+require 'puppet/util'
+
module Puppet::Util::SELinux
+ include Puppet::Util
+
def selinux_support?
FileTest.exists?("/selinux/enforce")
end
@@ -103,10 +107,15 @@ module Puppet::Util::SELinux
when :selrange
flag = "-l"
else
- flag = ""
+ flag = nil
end
- execute(["/usr/bin/chcon","-h",flag,value,file])
+ if flag.nil?
+ cmd = ["/usr/bin/chcon","-h",value,file]
+ else
+ cmd = ["/usr/bin/chcon","-h",flag,value,file]
+ end
+ execute(cmd)
return true
end