Class: Inspec::Resources::Ibmdb2Conf

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Ibmdb2Conf

Returns a new instance of Ibmdb2Conf.



18
19
20
21
22
23
24
25
# File 'lib/inspec/resources/ibmdb2_conf.rb', line 18

def initialize(opts = {})
  if inspec.os.platform?("unix")
    @db2_executable_file_path = opts[:db2_executable_file_path]
    @db_instance = opts[:db_instance]
    raise Inspec::Exceptions::ResourceFailed, "Can't connect to IBM DB2 without db2_executable_file_path, db_instance options provided." if @db2_executable_file_path.nil? || @db_instance.nil?
  end
  @output = run_command
end

Instance Attribute Details

#outputObject (readonly)

Returns the value of attribute output.



16
17
18
# File 'lib/inspec/resources/ibmdb2_conf.rb', line 16

def output
  @output
end

Instance Method Details

#resource_idObject



27
28
29
30
31
32
33
# File 'lib/inspec/resources/ibmdb2_conf.rb', line 27

def resource_id
  if inspec.os.platform?("windows")
    "ibmdb2_conf"
  else
    "ibmdb2_conf:DatabaseInstance:#{@db_instance}"
  end
end

#to_sObject



35
36
37
# File 'lib/inspec/resources/ibmdb2_conf.rb', line 35

def to_s
  "IBM Db2 Conf"
end