Class: Inspec::Resources::PostgresHbaConf

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hba_conf_path = nil) ⇒ PostgresHbaConf

TODO:

add checks to ensure that we have data in our file

Returns a new instance of PostgresHbaConf.



20
21
22
23
24
25
26
# File 'lib/resources/postgres_hba_conf.rb', line 20

def initialize(hba_conf_path = nil)
  return skip_resource 'The `postgres_hba_conf` resource is not supported on your OS.' unless inspec.os.linux?
  @conf_file = hba_conf_path || File.expand_path('pg_hba.conf', inspec.postgres.conf_dir)
  @content = ''
  @params = {}
  read_content
end

Instance Attribute Details

#conf_fileObject (readonly)

Returns the value of attribute conf_file.



17
18
19
# File 'lib/resources/postgres_hba_conf.rb', line 17

def conf_file
  @conf_file
end

#paramsObject (readonly)

Returns the value of attribute params.



17
18
19
# File 'lib/resources/postgres_hba_conf.rb', line 17

def params
  @params
end

Instance Method Details

#to_sObject



40
41
42
# File 'lib/resources/postgres_hba_conf.rb', line 40

def to_s
  "Postgres Hba Config #{@conf_file}"
end