module Inspec::Utils::BsdMountParser

Public Instance Methods

parse_mount_options(mount_line, _compatibility = false) click to toggle source

this parses the output of mount command (only tested on freebsd) this method expects only one line of the mount output

# File lib/inspec/utils/parser.rb, line 120
def parse_mount_options(mount_line, _compatibility = false)
  return {} if mount_line.nil? || mount_line.empty?

  mount = mount_line.chomp.split(" ", 4)
  options = mount[3].tr("()", "").split(", ")

  # parse device and type
  { device: mount[0], type: options.shift, options: options }
end