Method: Postgres#initialize

Defined in:
lib/resources/postgres.rb

#initializePostgres

Returns a new instance of Postgres.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/resources/postgres.rb', line 11

def initialize
  case inspec.os[:family]
  when 'ubuntu', 'debian'
    @service = 'postgresql'
    @data_dir = '/var/lib/postgresql'
    @version = inspec.command('ls /etc/postgresql/').stdout.chomp
    @conf_dir = "/etc/postgresql/#{@version}/main"
    @conf_path = File.join @conf_dir, 'postgresql.conf'

  when 'arch'
    @service = 'postgresql'
    @data_dir = '/var/lib/postgres/data'
    @conf_dir = '/var/lib/postgres/data'
    @conf_path = File.join @conf_dir, 'postgresql.conf'

  else
    @service = 'postgresql'
    @data_dir = '/var/lib/postgresql'
    @conf_dir = '/var/lib/pgsql/data'
    @conf_path = File.join @conf_dir, 'postgresql.conf'
  end
end