Class: Inspec::Resources::SybaseConf

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of SybaseConf.



16
17
18
19
20
21
22
# File 'lib/inspec/resources/sybase_conf.rb', line 16

def initialize(conf_param_name, opts = {})
  @conf_param = conf_param_name
  opts[:username] ||= "sa"
  opts[:database] ||= "master"
  sql_session = inspec.sybase_session(opts)
  @sql_query = sql_session.query("sp_configure \"#{conf_param}\"")
end

Instance Attribute Details

#conf_paramObject (readonly)

Returns the value of attribute conf_param.



15
16
17
# File 'lib/inspec/resources/sybase_conf.rb', line 15

def conf_param
  @conf_param
end

#sql_queryObject (readonly)

Returns the value of attribute sql_query.



15
16
17
# File 'lib/inspec/resources/sybase_conf.rb', line 15

def sql_query
  @sql_query
end

Instance Method Details

#config_valueObject



28
29
30
# File 'lib/inspec/resources/sybase_conf.rb', line 28

def config_value
  sql_query.row(0).column("Config Value").value
end

#resource_idObject



32
33
34
# File 'lib/inspec/resources/sybase_conf.rb', line 32

def resource_id
  conf_param || "Sybase config settings"
end

#run_valueObject



24
25
26
# File 'lib/inspec/resources/sybase_conf.rb', line 24

def run_value
  sql_query.row(0).column("Run Value").value
end

#to_sObject



36
37
38
# File 'lib/inspec/resources/sybase_conf.rb', line 36

def to_s
  "Sybase Conf #{conf_param}"
end