Method: Inspec::Resources::KernelModule#loaded?
- Defined in:
- lib/inspec/resources/kernel_module.rb
#loaded? ⇒ Boolean
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/inspec/resources/kernel_module.rb', line 42 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 |