Class: Inspec::Resources::CassandradbConf

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

Instance Attribute Summary

Attributes inherited from JsonConfig

#params, #raw_content

Instance Method Summary collapse

Methods inherited from JsonConfig

#method_missing, #to_s, #value

Methods included from FileReader

#read_file_content

Methods included from ObjectTraverser

#extract_value

Constructor Details

#initialize(conf_path = nil) ⇒ CassandradbConf

Returns a new instance of CassandradbConf.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/inspec/resources/cassandradb_conf.rb', line 16

def initialize(conf_path = nil)
  cassandra = nil
  if conf_path.nil?
    cassandra = inspec.cassandra
    @conf_path = cassandra.conf_path
  else
    @conf_path = conf_path
  end

  if cassandra && cassandra.resource_failed?
    raise cassandra.resource_exception_message
  elsif @conf_path.nil?
    return skip_resource "Cassandra db conf path is not set"
  end

  super(@conf_path)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Inspec::Resources::JsonConfig

Instance Method Details

#resource_idObject

if system unables to determine the cassandra conf path the @conf_path can be nil so in that case sending “” string as resource_id



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

def resource_id
  @conf_path || "cassandradb_conf"
end