Method: Inspec::Resources::MssqlSession#initialize

Defined in:
lib/resources/mssql_session.rb

#initialize(opts = {}) ⇒ MssqlSession

Returns a new instance of MssqlSession.



35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/resources/mssql_session.rb', line 35

def initialize(opts = {})
  @user = opts[:user]
  @password = opts[:password] || opts[:pass]
  if opts[:pass]
    warn '[DEPRECATED] use `password` option to supply password instead of `pass`'
  end
  @host = opts[:host] || 'localhost'
  @instance = opts[:instance]

  # check if sqlcmd is available
  return skip_resource('sqlcmd is missing') if !inspec.command('sqlcmd').exist?
  # check that database is reachable
  return skip_resource("Can't connect to the MS SQL Server.") if !test_connection
end