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 38 |
# File 'lib/resources/kernel_module.rb', line 23 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 |