class Inspec::Resources::Mount
Attributes
file[R]
Public Class Methods
new(path)
click to toggle source
# File lib/inspec/resources/mount.rb, line 20 def initialize(path) @path = path @mount_manager = mount_manager_for_os return skip_resource "The `mount` resource is not supported on your OS yet." if @mount_manager.nil? @file = inspec.backend.file(@path) end
Public Instance Methods
count()
click to toggle source
# File lib/inspec/resources/mount.rb, line 32 def count mounted = file.mounted return nil if mounted.nil? || mounted.stdout.nil? mounted.stdout.lines.count end
method_missing(name)
click to toggle source
# File lib/inspec/resources/mount.rb, line 39 def method_missing(name) return nil unless file.mounted? mounted = file.mounted return nil if mounted.nil? || mounted.stdout.nil? line = mounted.stdout # if we got multiple lines, only use the last entry line = mounted.stdout.lines.to_a.last if mounted.stdout.lines.count > 1 # parse content if we are on linux @mount_options ||= @mount_manager.parse_mount_options(line) @mount_options[name] end
mounted?()
click to toggle source
# File lib/inspec/resources/mount.rb, line 28 def mounted? file.mounted? end
to_s()
click to toggle source
# File lib/inspec/resources/mount.rb, line 54 def to_s "Mount #{@path}" end
Private Instance Methods
mount_manager_for_os()
click to toggle source
# File lib/inspec/resources/mount.rb, line 60 def mount_manager_for_os os = inspec.os if os.linux? LinuxMounts.new(inspec) elsif os.bsd? BsdMounts.new(inspec) end end