2015-08-01 07:21:32 +00:00
|
|
|
# encoding: utf-8
|
|
|
|
# copyright: 2015, Vulcano Security GmbH
|
|
|
|
# license: All rights reserved
|
|
|
|
|
2015-08-28 19:37:03 +00:00
|
|
|
class Postgres < Vulcano.resource(1)
|
|
|
|
name 'postgres'
|
|
|
|
|
2015-08-01 07:21:32 +00:00
|
|
|
attr_reader :service, :data_dir, :conf_dir, :conf_path
|
|
|
|
def initialize
|
2015-09-14 14:37:25 +00:00
|
|
|
case vulcano.os[:family]
|
2015-08-01 07:21:32 +00:00
|
|
|
when 'ubuntu', 'debian'
|
|
|
|
@service = 'postgresql'
|
|
|
|
@data_dir = '/var/lib/postgresql'
|
2015-08-30 02:33:15 +00:00
|
|
|
@version = vulcano.run_command('ls /etc/postgresql/').stdout.chomp
|
2015-08-01 07:21:32 +00:00
|
|
|
@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
|
|
|
|
end
|