Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions libraries/access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,10 @@ def to_s
entry_string.strip
end

def eql?(entry)
return false unless self.class.eql?(entry.class)
def eql?(other)
return false unless self.class.eql?(other.class)

return true if self.class.const_get(:ENTRY_FIELDS).all? { |field| send(field).eql?(entry.send(field)) }
return true if self.class.const_get(:ENTRY_FIELDS).all? { |field| send(field).eql?(other.send(field)) }

false
end
Expand Down Expand Up @@ -314,14 +314,14 @@ def to_s
end.join(' ')
end

def eql?(auth_options)
case auth_options
def eql?(other)
case other
when self.class
@options.eql?(auth_options.options)
@options.eql?(other.options)
when Hash
@options.eql?(auth_options)
@options.eql?(other)
when String
to_s.eql?(options_string_parse(auth_options))
to_s.eql?(options_string_parse(other))
else
false
end
Expand Down
2 changes: 1 addition & 1 deletion libraries/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def default_yum_gpg_key_uri
end

def dnf_module_platform?
(platform_family?('rhel') && node['platform_version'].to_i == 8)
platform_family?('rhel') && node['platform_version'].to_i == 8
end

# determine the appropriate DB init command to run based on RHEL/Amazon release
Expand Down
8 changes: 4 additions & 4 deletions libraries/ident.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def entry(map_name)
end

def entry?(map_name)
!@entries.filter { |e| e.map_name.eql?(map_name) }.empty?
!@entries.none? { |e| e.map_name.eql?(map_name) }
end

def include?(entry)
Expand Down Expand Up @@ -199,10 +199,10 @@ def to_s
entry_string.strip
end

def eql?(entry)
return false unless self.class.eql?(entry.class)
def eql?(other)
return false unless self.class.eql?(other.class)

return true if self.class.const_get(:ENTRY_FIELDS).all? { |field| send(field).eql?(entry.send(field)) }
return true if self.class.const_get(:ENTRY_FIELDS).all? { |field| send(field).eql?(other.send(field)) }

false
end
Expand Down
2 changes: 1 addition & 1 deletion libraries/sql/role.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def role_sql(new_resource)
next unless property_is_set?(perm)

if new_resource.send(perm)
sql.push("#{perm.to_s.upcase.gsub('_', ' ')}")
sql.push(perm.to_s.upcase.gsub('_', ' ').to_s)
else
sql.push("NO#{perm.to_s.upcase.gsub('_', ' ')}")
end
Expand Down
2 changes: 1 addition & 1 deletion resources/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
property :version, [String, Integer],
default: lazy { installed_postgresql_major_version },
desired_state: false,
coerce: proc { |p| p.to_s },
coerce: proc(&:to_s),
description: 'PostgreSQL installed version override'

property :data_directory, String,
Expand Down
2 changes: 1 addition & 1 deletion resources/database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

property :connection_limit, [Integer, String],
default: -1,
coerce: proc { |p| p.to_s },
coerce: proc(&:to_s),
description: 'How many concurrent connections can be made to this database. -1 (the default) means no limit.'

property :is_template, [true, false],
Expand Down
6 changes: 3 additions & 3 deletions resources/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@

property :version, [String, Integer],
default: '17',
coerce: proc { |p| p.to_s },
coerce: proc(&:to_s),
description: 'Version to install'

property :source, [String, Symbol],
default: :repo,
coerce: proc { |p| p.to_sym },
coerce: proc(&:to_sym),
equal_to: %i(repo os),
description: 'Installation source'

Expand Down Expand Up @@ -191,7 +191,7 @@ def do_repository_action(repo_action)

package 'apt-transport-https'

apt_repository "postgresql_org_repository_#{new_resource.version.to_s}" do
apt_repository "postgresql_org_repository_#{new_resource.version}" do
uri new_resource.apt_repository_uri
components ['main', new_resource.version.to_s]
distribution "#{node['lsb']['codename']}-pgdg"
Expand Down
2 changes: 1 addition & 1 deletion resources/role.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

property :connection_limit, [Integer, String],
default: -1,
coerce: proc { |p| p.to_s },
coerce: proc(&:to_s),
description: 'If role can log in, this specifies how many concurrent connections the role can make'

property :unencrypted_password, String,
Expand Down
44 changes: 22 additions & 22 deletions test/cookbooks/test/recipes/all_repos_install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@
version '15'

server_config({
'max_connections' => 110,
'shared_buffers' => '128MB',
'dynamic_shared_memory_type' => 'posix',
'max_wal_size' => '1GB',
'min_wal_size' => '80MB',
'log_destination' => 'stderr',
'logging_collector' => true,
'log_directory' => 'log',
'log_filename' => 'postgresql-%a.log',
'log_rotation_age' => '1d',
'log_rotation_size' => 0,
'log_truncate_on_rotation' => true,
'log_line_prefix' => '%m [%p]',
'log_timezone' => 'Etc/UTC',
'datestyle' => 'iso, mdy',
'timezone' => 'Etc/UTC',
'lc_messages' => 'C',
'lc_monetary' => 'C',
'lc_numeric' => 'C',
'lc_time' => 'C',
'default_text_search_config' => 'pg_catalog.english',
})
'max_connections' => 110,
'shared_buffers' => '128MB',
'dynamic_shared_memory_type' => 'posix',
'max_wal_size' => '1GB',
'min_wal_size' => '80MB',
'log_destination' => 'stderr',
'logging_collector' => true,
'log_directory' => 'log',
'log_filename' => 'postgresql-%a.log',
'log_rotation_age' => '1d',
'log_rotation_size' => 0,
'log_truncate_on_rotation' => true,
'log_line_prefix' => '%m [%p]',
'log_timezone' => 'Etc/UTC',
'datestyle' => 'iso, mdy',
'timezone' => 'Etc/UTC',
'lc_messages' => 'C',
'lc_monetary' => 'C',
'lc_numeric' => 'C',
'lc_time' => 'C',
'default_text_search_config' => 'pg_catalog.english',
})

notifies :restart, 'postgresql_service[postgresql]', :delayed
action :create
Expand Down
44 changes: 22 additions & 22 deletions test/cookbooks/test/recipes/no_repos_install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,28 @@
version '15'

server_config({
'max_connections' => 110,
'shared_buffers' => '128MB',
'dynamic_shared_memory_type' => 'posix',
'max_wal_size' => '1GB',
'min_wal_size' => '80MB',
'log_destination' => 'stderr',
'logging_collector' => true,
'log_directory' => 'log',
'log_filename' => 'postgresql-%a.log',
'log_rotation_age' => '1d',
'log_rotation_size' => 0,
'log_truncate_on_rotation' => true,
'log_line_prefix' => '%m [%p]',
'log_timezone' => 'Etc/UTC',
'datestyle' => 'iso, mdy',
'timezone' => 'Etc/UTC',
'lc_messages' => 'C',
'lc_monetary' => 'C',
'lc_numeric' => 'C',
'lc_time' => 'C',
'default_text_search_config' => 'pg_catalog.english',
})
'max_connections' => 110,
'shared_buffers' => '128MB',
'dynamic_shared_memory_type' => 'posix',
'max_wal_size' => '1GB',
'min_wal_size' => '80MB',
'log_destination' => 'stderr',
'logging_collector' => true,
'log_directory' => 'log',
'log_filename' => 'postgresql-%a.log',
'log_rotation_age' => '1d',
'log_rotation_size' => 0,
'log_truncate_on_rotation' => true,
'log_line_prefix' => '%m [%p]',
'log_timezone' => 'Etc/UTC',
'datestyle' => 'iso, mdy',
'timezone' => 'Etc/UTC',
'lc_messages' => 'C',
'lc_monetary' => 'C',
'lc_numeric' => 'C',
'lc_time' => 'C',
'default_text_search_config' => 'pg_catalog.english',
})

notifies :restart, 'postgresql_service[postgresql]', :delayed
action :create
Expand Down
44 changes: 22 additions & 22 deletions test/cookbooks/test/recipes/server_install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@
version '15'

server_config({
'max_connections' => 110,
'shared_buffers' => '128MB',
'dynamic_shared_memory_type' => 'posix',
'max_wal_size' => '1GB',
'min_wal_size' => '80MB',
'log_destination' => 'stderr',
'logging_collector' => true,
'log_directory' => 'log',
'log_filename' => 'postgresql-%a.log',
'log_rotation_age' => '1d',
'log_rotation_size' => 0,
'log_truncate_on_rotation' => true,
'log_line_prefix' => '%m [%p]',
'log_timezone' => 'Etc/UTC',
'datestyle' => 'iso, mdy',
'timezone' => 'Etc/UTC',
'lc_messages' => 'C',
'lc_monetary' => 'C',
'lc_numeric' => 'C',
'lc_time' => 'C',
'default_text_search_config' => 'pg_catalog.english',
})
'max_connections' => 110,
'shared_buffers' => '128MB',
'dynamic_shared_memory_type' => 'posix',
'max_wal_size' => '1GB',
'min_wal_size' => '80MB',
'log_destination' => 'stderr',
'logging_collector' => true,
'log_directory' => 'log',
'log_filename' => 'postgresql-%a.log',
'log_rotation_age' => '1d',
'log_rotation_size' => 0,
'log_truncate_on_rotation' => true,
'log_line_prefix' => '%m [%p]',
'log_timezone' => 'Etc/UTC',
'datestyle' => 'iso, mdy',
'timezone' => 'Etc/UTC',
'lc_messages' => 'C',
'lc_monetary' => 'C',
'lc_numeric' => 'C',
'lc_time' => 'C',
'default_text_search_config' => 'pg_catalog.english',
})

notifies :restart, 'postgresql_service[postgresql]', :delayed
action :create
Expand Down
38 changes: 19 additions & 19 deletions test/cookbooks/test/recipes/server_install_os.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@

postgresql_config 'postgresql-server' do
server_config({
max_connections: 110,
shared_buffers: '128MB',
log_destination: 'stderr',
logging_collector: true,
log_directory: 'log',
log_filename: 'postgresql-%a.log',
log_rotation_age: '1d',
log_rotation_size: 0,
log_truncate_on_rotation: true,
log_line_prefix: '%m [%p]',
log_timezone: 'Etc/UTC',
datestyle: 'iso, mdy',
timezone: 'Etc/UTC',
lc_messages: 'C',
lc_monetary: 'C',
lc_numeric: 'C',
lc_time: 'C',
default_text_search_config: 'pg_catalog.english',
})
max_connections: 110,
shared_buffers: '128MB',
log_destination: 'stderr',
logging_collector: true,
log_directory: 'log',
log_filename: 'postgresql-%a.log',
log_rotation_age: '1d',
log_rotation_size: 0,
log_truncate_on_rotation: true,
log_line_prefix: '%m [%p]',
log_timezone: 'Etc/UTC',
datestyle: 'iso, mdy',
timezone: 'Etc/UTC',
lc_messages: 'C',
lc_monetary: 'C',
lc_numeric: 'C',
lc_time: 'C',
default_text_search_config: 'pg_catalog.english',
})

notifies :restart, 'postgresql_service[postgresql]', :delayed
action :create
Expand Down
8 changes: 4 additions & 4 deletions test/integration/initdb_locale/controls/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
postgres_access = postgres_session('postgres', '12345', '127.0.0.1')

describe postgres_access.query('SHOW LC_MONETARY;') do
its('output') { should include "#{os.release.to_i < 8 ? 'en_US.utf8' : 'C.UTF-8'}" }
its('output') { should include (os.release.to_i < 8 ? 'en_US.utf8' : 'C.UTF-8').to_s }
end

describe postgres_access.query('SHOW LC_MESSAGES;') do
its('output') { should include "#{os.release.to_i < 8 ? 'en_US.utf8' : 'C.UTF-8'}" }
its('output') { should include (os.release.to_i < 8 ? 'en_US.utf8' : 'C.UTF-8').to_s }
end

describe postgres_access.query('SHOW LC_NUMERIC;') do
its('output') { should include "#{os.release.to_i < 8 ? 'en_US.utf8' : 'C.UTF-8'}" }
its('output') { should include (os.release.to_i < 8 ? 'en_US.utf8' : 'C.UTF-8').to_s }
end

describe postgres_access.query('SHOW LC_TIME;') do
its('output') { should include "#{os.release.to_i < 8 ? 'en_US.utf8' : 'C.UTF-8'}" }
its('output') { should include (os.release.to_i < 8 ? 'en_US.utf8' : 'C.UTF-8').to_s }
end
end
Loading