Class: Inspec::Resources::MssqlSysConf

Inherits:
Object
  • Object
show all
Defined in:
lib/inspec/resources/mssql_sys_conf.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(conf_param_name, opts = {}) ⇒ MssqlSysConf

Returns a new instance of MssqlSysConf.



21
22
23
24
25
26
27
28
# File 'lib/inspec/resources/mssql_sys_conf.rb', line 21

def initialize(conf_param_name, opts = {})
  @conf_param_name = conf_param_name
  @opts = opts
  opts[:username] ||= "SA"
  @mssql_session = inspec.mssql_session(opts)
  setting = conf_param_name.to_s.gsub("_", " ").split.map(&:capitalize).join(" ")
  determine_system_configurations(setting)
end

Instance Attribute Details

#mssql_sessionObject (readonly)

Returns the value of attribute mssql_session.



19
20
21
# File 'lib/inspec/resources/mssql_sys_conf.rb', line 19

def mssql_session
  @mssql_session
end

#sql_queryObject (readonly)

Returns the value of attribute sql_query.



19
20
21
# File 'lib/inspec/resources/mssql_sys_conf.rb', line 19

def sql_query
  @sql_query
end

Instance Method Details

#resource_idObject



42
43
44
45
# File 'lib/inspec/resources/mssql_sys_conf.rb', line 42

def resource_id
  username = @opts[:username] || "SA"
  "#{@conf_param_name}-#{username}"
end

#to_sObject



38
39
40
# File 'lib/inspec/resources/mssql_sys_conf.rb', line 38

def to_s
  "MsSql DB Configuration"
end

#value_configuredObject



34
35
36
# File 'lib/inspec/resources/mssql_sys_conf.rb', line 34

def value_configured
  sql_query.row(0).column("value_configured").value
end

#value_in_useObject



30
31
32
# File 'lib/inspec/resources/mssql_sys_conf.rb', line 30

def value_in_use
  sql_query.row(0).column("value_in_use").value
end