Class: Specinfra::Command::Linux::Base::Selinux

Inherits:
Base::Selinux show all
Defined in:
lib/specinfra/command/linux/base/selinux.rb

Class Method Summary collapse

Methods inherited from Base

create, escape

Class Method Details

.check_has_mode(mode) ⇒ Object


3
4
5
6
7
8
9
10
# File 'lib/specinfra/command/linux/base/selinux.rb', line 3

def check_has_mode(mode)
  cmd =  ""
  cmd += "test ! -f /etc/selinux/config || (" if mode == "disabled"
  cmd += "getenforce | grep -i -- #{escape(mode)} "
  cmd += "&& grep -i -- ^SELINUX=#{escape(mode)}$ /etc/selinux/config"
  cmd += ")" if mode == "disabled"
  cmd
end