Update the postgresql upstream cookbook
This commit is contained in:
@@ -16,12 +16,12 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
property :access_type, String, required: true, default: 'local'
|
||||
property :access_db, String, required: true, default: 'all'
|
||||
property :access_user, String, required: true, default: 'postgres'
|
||||
property :access_method, String, required: true, default: 'ident'
|
||||
property :cookbook, String, default: 'postgresql'
|
||||
property :source, String, default: 'pg_hba.conf.erb'
|
||||
property :access_type, String, default: 'local'
|
||||
property :access_db, String, default: 'all'
|
||||
property :access_user, String, default: 'postgres'
|
||||
property :access_method, String, default: 'ident'
|
||||
property :cookbook, String, default: 'postgresql'
|
||||
property :source, String, default: 'pg_hba.conf.erb'
|
||||
property :access_addr, String
|
||||
property :comment, String
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ property :owner, String
|
||||
# Connection prefernces
|
||||
property :user, String, default: 'postgres'
|
||||
property :database, String, name_property: true
|
||||
property :host, [String, nil], default: nil
|
||||
property :host, String
|
||||
property :port, Integer, default: 5432
|
||||
|
||||
action :create do
|
||||
|
||||
@@ -30,6 +30,7 @@ action :create do
|
||||
code create_extension_sql(new_resource)
|
||||
user 'postgres'
|
||||
action :run
|
||||
environment(psql_environment)
|
||||
not_if { follower? || extension_installed?(new_resource) }
|
||||
end
|
||||
end
|
||||
@@ -39,6 +40,7 @@ action :drop do
|
||||
code psql_command_string(new_resource, "DROP EXTENSION IF EXISTS \"#{new_resource.extension}\"")
|
||||
user 'postgres'
|
||||
action :run
|
||||
environment(psql_environment)
|
||||
not_if { follower? }
|
||||
only_if { extension_installed?(new_resource) }
|
||||
end
|
||||
|
||||
@@ -21,11 +21,11 @@ property :source, String, default: 'pg_ident.conf.erb'
|
||||
property :cookbook, String, default: 'postgresql'
|
||||
property :system_user, String, required: true
|
||||
property :pg_user, String, required: true
|
||||
property :comment, [String, nil], default: nil
|
||||
property :comment, String
|
||||
|
||||
action :create do
|
||||
ident_resource = new_resource
|
||||
with_run_context :root do # ~FC037
|
||||
with_run_context :root do
|
||||
edit_resource(:template, "#{conf_dir}/pg_ident.conf") do |new_resource|
|
||||
source new_resource.source
|
||||
cookbook new_resource.cookbook
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# frozen_string_literal: true
|
||||
#
|
||||
# Cookbook:: postgresql
|
||||
# Resource:: server_install
|
||||
@@ -26,6 +25,7 @@ property :external_pid_file, String, default: lazy { "/var/run/postgresql/#{vers
|
||||
property :password, [String, nil], default: 'generate' # Set to nil if we do not want to set a password
|
||||
property :port, Integer, default: 5432
|
||||
property :initdb_locale, String
|
||||
property :initdb_encoding, String
|
||||
|
||||
# Connection preferences
|
||||
property :user, String, default: 'postgres'
|
||||
@@ -41,6 +41,23 @@ action :install do
|
||||
setup_repo new_resource.setup_repo
|
||||
end
|
||||
|
||||
# First install the postgresql-common package
|
||||
if platform_family?('debian')
|
||||
package 'postgresql-common'
|
||||
|
||||
initdb_options = ''
|
||||
initdb_options << "--locale #{new_resource.initdb_locale}" if new_resource.initdb_locale
|
||||
initdb_options << " -E #{new_resource.initdb_encoding}" if new_resource.initdb_encoding
|
||||
|
||||
template '/etc/postgresql-common/createcluster.conf' do
|
||||
source 'createcluster.conf.erb'
|
||||
cookbook 'postgresql'
|
||||
variables(
|
||||
initdb_options: initdb_options
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
package server_pkg_name
|
||||
end
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ action :create do
|
||||
user 'postgres'
|
||||
command create_user_sql(new_resource)
|
||||
sensitive new_resource.sensitive
|
||||
environment(psql_environment)
|
||||
not_if { follower? || user_exists?(new_resource) }
|
||||
end
|
||||
end
|
||||
@@ -49,6 +50,7 @@ action :update do
|
||||
execute "update postgresql user #{new_resource.create_user}" do
|
||||
user 'postgres'
|
||||
command update_user_sql(new_resource)
|
||||
environment(psql_environment)
|
||||
sensitive true
|
||||
not_if { follower? }
|
||||
only_if { user_exists?(new_resource) }
|
||||
@@ -64,6 +66,7 @@ action :update do
|
||||
execute "Update postgresql user #{new_resource.create_user} to set #{attr}" do
|
||||
user 'postgres'
|
||||
command update_user_with_attributes_sql(new_resource, v)
|
||||
environment(psql_environment)
|
||||
sensitive true
|
||||
not_if { follower? }
|
||||
only_if { user_exists?(new_resource) }
|
||||
@@ -76,6 +79,7 @@ action :drop do
|
||||
execute "drop postgresql user #{new_resource.create_user}" do
|
||||
user 'postgres'
|
||||
command drop_user_sql(new_resource)
|
||||
environment(psql_environment)
|
||||
sensitive true
|
||||
not_if { follower? }
|
||||
only_if { user_exists?(new_resource) }
|
||||
|
||||
Reference in New Issue
Block a user