Method: Inspec::Resources::KernelModule#loaded?
- Defined in:
- lib/resources/kernel_module.rb
#loaded? ⇒ Boolean
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/resources/kernel_module.rb', line 43 def loaded? if inspec.os.redhat? || inspec.os.name == 'fedora' lsmod_cmd = '/sbin/lsmod' else lsmod_cmd = 'lsmod' end # 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 |