Class: Inspec::Resources::Postgres
- Inherits:
-
Object
- Object
- Inspec::Resources::Postgres
- Defined in:
- lib/resources/postgres.rb
Instance Attribute Summary collapse
-
#conf_dir ⇒ Object
readonly
Returns the value of attribute conf_dir.
-
#conf_path ⇒ Object
readonly
Returns the value of attribute conf_path.
-
#data_dir ⇒ Object
readonly
Returns the value of attribute data_dir.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
Instance Method Summary collapse
-
#initialize ⇒ Postgres
constructor
A new instance of Postgres.
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Postgres
Returns a new instance of Postgres.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/resources/postgres.rb', line 12 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' when 'centos', 'redhat' @service = 'postgresql' @version = inspec.command('ls /var/lib/pgsql/').stdout.chomp @data_dir = "/var/lib/pgsql/#{@version}/data" @conf_dir = "/var/lib/pgsql/#{@version}/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 |
Instance Attribute Details
#conf_dir ⇒ Object (readonly)
Returns the value of attribute conf_dir.
11 12 13 |
# File 'lib/resources/postgres.rb', line 11 def conf_dir @conf_dir end |
#conf_path ⇒ Object (readonly)
Returns the value of attribute conf_path.
11 12 13 |
# File 'lib/resources/postgres.rb', line 11 def conf_path @conf_path end |
#data_dir ⇒ Object (readonly)
Returns the value of attribute data_dir.
11 12 13 |
# File 'lib/resources/postgres.rb', line 11 def data_dir @data_dir end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
11 12 13 |
# File 'lib/resources/postgres.rb', line 11 def service @service end |
Instance Method Details
#to_s ⇒ Object
42 43 44 |
# File 'lib/resources/postgres.rb', line 42 def to_s 'PostgreSQL' end |