Sha256: fac0afc333fa3c2e46132ba03300c0adc54c6e409de186ac9dd18dd4181e382a

Contents?: true

Size: 1.06 KB

Versions: 28

Compression:

Stored size: 1.06 KB

Contents

# encoding: utf-8
# copyright: 2015, Vulcano Security GmbH
# author: Dominik Richter
# author: Christoph Hartmann
# license: All rights reserved

module Inspec::Resources
  class Postgres < Inspec.resource(1)
    name 'postgres'

    attr_reader :service, :data_dir, :conf_dir, :conf_path
    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

    def to_s
      'PostgreSQL'
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
inspec-0.27.0 lib/resources/postgres.rb
inspec-0.26.0 lib/resources/postgres.rb
inspec-0.25.0 lib/resources/postgres.rb
inspec-0.24.0 lib/resources/postgres.rb
inspec-0.23 lib/resources/postgres.rb
inspec-0.22.1 lib/resources/postgres.rb
inspec-0.22.0 lib/resources/postgres.rb
inspec-0.21.6 lib/resources/postgres.rb
inspec-0.21.5 lib/resources/postgres.rb
inspec-0.21.4 lib/resources/postgres.rb
inspec-0.21.3 lib/resources/postgres.rb
inspec-0.21.2 lib/resources/postgres.rb
inspec-0.21.1 lib/resources/postgres.rb
inspec-0.21.0 lib/resources/postgres.rb
inspec-0.20.1 lib/resources/postgres.rb
inspec-0.20.0 lib/resources/postgres.rb
inspec-0.19.2 lib/resources/postgres.rb
inspec-0.19.1 lib/resources/postgres.rb
inspec-0.19.0 lib/resources/postgres.rb
inspec-0.18.0 lib/resources/postgres.rb