summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util/selinux.rb
diff options
context:
space:
mode:
authorJames Turnbull <james@lovedthanlost.net>2010-01-13 08:07:30 +1100
committerJames Turnbull <james@lovedthanlost.net>2010-01-13 08:07:30 +1100
commitb6f90dfcd96123c245b6f5fd93753790006387c0 (patch)
tree1668fd8ed480dc0d0cb49c4a3d7f8a13c77dbeb9 /lib/puppet/util/selinux.rb
parente26e8319186c57a41ea7ca58b0e8e853e9b452e3 (diff)
parentf7e14356ad7781fafa52a459d3c24372fa6c0900 (diff)
downloadpuppet-b6f90dfcd96123c245b6f5fd93753790006387c0.tar.gz
puppet-b6f90dfcd96123c245b6f5fd93753790006387c0.tar.xz
puppet-b6f90dfcd96123c245b6f5fd93753790006387c0.zip
Merge branch '0.25.x'
Conflicts: lib/puppet/ssl/host.rb spec/spec_helper.rb
Diffstat (limited to 'lib/puppet/util/selinux.rb')
-rw-r--r--lib/puppet/util/selinux.rb12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/puppet/util/selinux.rb b/lib/puppet/util/selinux.rb
index 3eff03996..3801ecdb0 100644
--- a/lib/puppet/util/selinux.rb
+++ b/lib/puppet/util/selinux.rb
@@ -7,11 +7,7 @@
# was abysmal. At this time (2008-11-02) the only distribution providing
# these Ruby SELinux bindings which I am aware of is Fedora (in libselinux-ruby).
-begin
- require 'selinux'
-rescue LoadError
- # Nothing
-end
+Puppet.features.selinux? # check, but continue even if it's not
require 'pathname'
@@ -73,7 +69,7 @@ module Puppet::Util::SELinux
if context.nil? or context == "unlabeled"
return nil
end
- unless context =~ /^([a-z0-9_]+):([a-z0-9_]+):([a-z0-9_]+)(?::([a-zA-Z0-9:,._-]+))?/
+ unless context =~ /^([a-z0-9_]+):([a-z0-9_]+):([a-zA-Z0-9_]+)(?::([a-zA-Z0-9:,._-]+))?/
raise Puppet::Error, "Invalid context to parse: #{context}"
end
ret = {
@@ -170,8 +166,8 @@ module Puppet::Util::SELinux
# that's expected
rescue
return nil
- ensure
- mountfh.close
+ ensure
+ mountfh.close if mountfh
end
mntpoint = {}