Skip to content

Commit

Permalink
Add postgresql_conf_file attribute and update configuration file hand…
Browse files Browse the repository at this point in the history
…ling
  • Loading branch information
rgomezborder committed Jan 3, 2025
1 parent 14827ec commit 97e07db
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions resources/providers/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
begin
user = new_resource.user
virtual_ip_file = new_resource.virtual_ip_file
postgresql_conf_file = new_resource.postgresql_conf_file
routes = local_routes

begin
Expand Down Expand Up @@ -46,7 +47,6 @@

ruby_block 'update_postgresql_conf' do
block do
postgresql_conf_file = '/var/lib/pgsql/data/postgresql.conf'
if ::File.exist?(postgresql_conf_file) && postgresql_vip['ip'] == postgresql_conf_host(postgresql_conf_file)
update_postgresql_conf(postgresql_conf_file)
system('systemctl reload postgresql.service')
Expand All @@ -64,15 +64,15 @@
variables(virtual_ip: postgresql_vip['ip'] || '')
end

unless ::File.exist? '/var/lib/pgsql/data/postgresql.conf'
unless ::File.exist? postgresql_conf_file
Chef::Log.info('Initializing postgresql service')
execute 'postgresql_initdb' do
user user
command 'initdb -D /var/lib/pgsql/data'
action :run
end

template '/var/lib/pgsql/data/postgresql.conf' do
template postgresql_conf_file do
source 'postgresql.conf.erb'
owner user
group user
Expand Down
1 change: 1 addition & 0 deletions resources/resources/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
attribute :cdomain, kind_of: String, default: 'redborder.cluster'
attribute :ipaddress, kind_of: String, default: '127.0.0.1'
attribute :virtual_ip_file, kind_of: String, default: '/etc/redborder/pg_virtual_ip_registered.txt'
attribute :postgresql_conf_file, kind_of: String, default: '/var/lib/pgsql/data/postgresql.conf'

0 comments on commit 97e07db

Please sign in to comment.