class Inspec::Resources::InetdConf

Public Class Methods

new(path = nil) click to toggle source
# File lib/inspec/resources/inetd_conf.rb, line 21
def initialize(path = nil)
  @conf_path = path || "/etc/inetd.conf"
  @content = read_file_content(@conf_path)
end

Public Instance Methods

exec() click to toggle source

overwrite exec to ensure it works with its TODO: this needs to be fixed in RSpec

# File lib/inspec/resources/inetd_conf.rb, line 28
def exec
  read_params["exec"]
end
method_missing(name) click to toggle source
# File lib/inspec/resources/inetd_conf.rb, line 32
def method_missing(name)
  read_params[name.to_s]
end
read_params() click to toggle source
# File lib/inspec/resources/inetd_conf.rb, line 36
def read_params
  return @params if defined?(@params)

  # parse the file
  conf = SimpleConfig.new(
    @content,
    assignment_regex: /^\s*(\S+?)\s+(.*?)\s+(.*?)\s+(.*?)\s+(.*?)\s+(.*?)\s+(.*?)\s*$/,
    key_values: 6,
    multiple_values: false
  )
  @params = conf.params
end
to_s() click to toggle source
# File lib/inspec/resources/inetd_conf.rb, line 49
def to_s
  "inetd.conf"
end