-
Notifications
You must be signed in to change notification settings - Fork 612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unbreak Debian support with custom encoding #1564
base: main
Are you sure you want to change the base?
Changes from all commits
7e8d5fb
bf60b8f
40cca89
78c9df9
28003ef
5c1443e
fa69745
63b0476
a89ec51
b7125d3
692f6e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,11 +135,7 @@ def matches(value) | |
end | ||
|
||
autorequire(:anchor) do | ||
["postgresql::server::service::begin::#{self[:instance]}"] | ||
end | ||
|
||
autorequire(:service) do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm trying to understand the logic. Don't you always need the server to be running to execute any SQL statements? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, but the service doesn't seem to be available immediately after start. There's a custom resource that waits until the tcp port is open and I think we should depend on that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh yes, that makes sense. Though with the newest versions (Fedora 38 with PostgreSQL 15) I see the systemd unit is Digging into this, it was introduced in postgres/postgres@7d17e68 so with PostgreSQL 9.6 it became possible to support. Looking at EL8 that's built with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
These seem to be the relevant bugs about this: |
||
["postgresqld_instance_#{self[:instance]}"] | ||
["postgresql::server::service::end::#{self[:instance]}"] | ||
end | ||
|
||
def should_run_sql(refreshing = false) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,10 @@ | |
status => $service_status, | ||
} | ||
|
||
Anchor["postgresql::server::service::begin::${name}"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I may deeply regret asking when I do not have a full background on this but my understanding was Anchor was a redundant pattern as the contain function came in? |
||
-> Service["postgresqld_instance_${name}"] | ||
-> Anchor["postgresql::server::service::end::${name}"] | ||
|
||
if $service_ensure in ['running', true] { | ||
# This blocks the class before continuing if chained correctly, making | ||
# sure the service really is 'up' before continuing. | ||
|
@@ -56,10 +60,13 @@ | |
sleep => 1, | ||
tries => 60, | ||
psql_path => $psql_path, | ||
require => Service["postgresqld_instance_${name}"], | ||
before => Anchor["postgresql::server::service::end::${name}"], | ||
} | ||
Postgresql::Server::Database <| title == $default_database |> -> Postgresql_conn_validator["validate_service_is_running_instance_${name}"] | ||
|
||
Anchor["postgresql::server::service::begin::${name}"] | ||
-> Service["postgresqld_instance_${name}"] | ||
-> Postgresql::Server::Database <| title == $default_database |> | ||
-> Postgresql_conn_validator["validate_service_is_running_instance_${name}"] | ||
-> Anchor["postgresql::server::service::end::${name}"] | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper_acceptance' | ||
|
||
describe 'postgresql::server' do | ||
let(:pp) do | ||
ENV['RSPEC_DEBUG'] = 'yes' | ||
<<-MANIFEST | ||
class { 'postgresql::globals': | ||
encoding => 'UTF8', | ||
locale => 'en_NG', | ||
} -> | ||
class { 'postgresql::server': } | ||
MANIFEST | ||
end | ||
|
||
it 'with defaults' do | ||
export_locales('en_NG.UTF8') | ||
idempotent_apply(pp, debug: true) | ||
puts '-------------------------------' | ||
puts LitmusHelper.instance.run_shell('ss -lntp').stdout | ||
puts '-------------------------------' | ||
puts LitmusHelper.instance.run_shell('journalctl -u postgresql').stdout | ||
puts '-------------------------------' | ||
puts LitmusHelper.instance.run_shell('systemctl status postgresql*').stdout | ||
puts '-------------------------------' | ||
puts LitmusHelper.instance.run_shell("su postgres -c 'psql -c \\\\l'").stdout | ||
puts '-------------------------------' | ||
puts LitmusHelper.instance.run_shell('true &>/dev/null </dev/tcp/127.0.0.1/5432 && echo open || echo closed').stdout | ||
puts '-------------------------------' | ||
expect(port(5432)).to be_listening.on('127.0.0.1').with('tcp') | ||
expect(psql('--command="\l" postgres', 'postgres').stdout).to match(%r{List of databases}) | ||
expect(psql('--command="SELECT pg_encoding_to_char(encoding) FROM pg_database WHERE datname=\'template1\'"').stdout).to match(%r{UTF8}) | ||
end | ||
end |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as an alternative, can we maybe autorequire the postgresql_conn_validator resource?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That quite make sense. I'll dig into this.