Method: Inspec::Resources::KernelModule#loaded?
- Defined in:
- lib/resources/kernel_module.rb
#loaded? ⇒ Boolean
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/resources/kernel_module.rb', line 23 def loaded? # default lsmod command lsmod_cmd = 'lsmod' # special care for CentOS 5 and sudo lsmod_cmd = '/sbin/lsmod' if inspec.os[:name] == 'centos' && inspec.os[:release].to_i == 5 # get list of all modules cmd = inspec.command(lsmod_cmd) return false if cmd.exit_status != 0 # check if module is loaded re = Regexp.new('^'+Regexp.quote(@module)+'\s') found = cmd.stdout.match(re) !found.nil? end |