Skip to content

Change default postgres version to 14 #379

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

Merged
Merged
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
4 changes: 1 addition & 3 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ fixtures:
augeas_core: 'https://github.com/puppetlabs/puppetlabs-augeas_core.git'
postgresql: 'https://github.com/puppetlabs/puppetlabs-postgresql.git'
firewall: 'https://github.com/puppetlabs/puppetlabs-firewall.git'
postgresql:
repo: 'https://github.com/puppetlabs/puppetlabs-postgresql.git'
ref: 'v9.2.0'
postgresql: 'https://github.com/puppetlabs/puppetlabs-postgresql.git'
firewall: 'https://github.com/puppetlabs/puppetlabs-firewall.git'
symlinks:
puppetdb: '#{source_dir}'
6 changes: 1 addition & 5 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@
$manage_pg_repo = false
}

if $puppetdb_version in ['latest','present'] or versioncmp($puppetdb_version, '7.0.0') >= 0 {
$postgres_version = '11'
} else {
$postgres_version = '9.6'
}
$postgres_version = '14'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My guess is that not passing an explicit version by default and letting the puppetlabs-postgresql module default to be used would be more portable. Unfortunately, this module is currently so broken testing anything require way more efforts that I can afford 😒

The fact that the module manage PostgreSQL by default is a bad practice IMHO. ATM, my recommendation for integrating PuppetDB in a control repo would be to have a puppetdb profile like this (have a dedicated PostgreSQL / firewall profile, disable firewall and dbserver, and use whatever settings you want):

class profile::puppetdb {
  include profile::postgresql

  class { 'puppetdb':
    manage_firewall  => false,
    manage_dbserver  => false,
    node_ttl         => '0d',
    node_purge_ttl   => '0d',
  }

  class { 'puppetdb::master::config':
    manage_report_processor => true,
    enable_reports          => true,
  }
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this module is currently so broken testing anything require way more efforts that I can afford

I feel so the same. And the lacking CI pipeline is really a problem for me when I review PRs. I suggest to wait for #378 until we merge anything here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can understand that perspective. An alternative one is that updating the value doesn't make things worse than they already are and will make it functional. the "11" value is known to not work and that "14" does. The application has specific expectations about the version of Postgres used and 8.x expects 14. Updating the value doesn't make things worse than they already are.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonathannewman stupid question, will this upgrade existing installations from 11 or whatever to 14? We should reflect this properly in the CHANGELOG.md

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good point.


$puppetdb_major_version = $puppetdb_version ? {
'latest' => '8',
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
{
"name": "puppetlabs/postgresql",
"version_requirement": ">= 6.5.0 < 10.0.0"
"version_requirement": ">= 6.5.0 < 11.0.0"
},
{
"name": "puppetlabs/firewall",
Expand Down
3 changes: 1 addition & 2 deletions spec/acceptance/standalone_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
let(:puppetdb_params) {}
let(:puppetdb_master_config_params) {}

# TODO: temporary work-around for EL installs
let(:postgres_version) { "(getvar('facts.os.family') == 'RedHat') ? { true => '12', default => undef }" }
let(:postgres_version) { 'undef' } # default
let(:manage_firewall) { "(getvar('facts.os.family') == 'RedHat' and Integer(getvar('facts.os.release.major')) > 7)" }

describe 'with defaults' do
Expand Down
12 changes: 0 additions & 12 deletions spec/support/acceptance/shared/puppetdb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,7 @@
shared_examples 'puppetdb' do
let(:pp) do
<<~PP
# FIXME: temporary work-around for EL installs
if $facts['os']['family'] == 'RedHat' {
$gpg_key_file = $facts['os']['release']['major'] ? {
'7' => 'PGDG-RPM-GPG-KEY-RHEL7',
default => 'PGDG-RPM-GPG-KEY-RHEL',
}
file { "/etc/pki/rpm-gpg/${gpg_key_file}":
source => "https://download.postgresql.org/pub/repos/yum/keys/${gpg_key_file}",
}
-> Yumrepo <| tag == 'postgresql::repo' |> {
gpgkey => "file:///etc/pki/rpm-gpg/${gpg_key_file}",
}

# Work-around EL systemd in docker bug affecting forked services
file_line { 'puppetdb-unit-remove-pidfile':
path => '/lib/systemd/system/puppetdb.service',
Expand Down
2 changes: 1 addition & 1 deletion spec/support/unit/shared/database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
end

shared_examples 'puppetdb::database::postgresql_ssl_rules' do |error|
let(:defaults) { {} }
let(:defaults) { { postgres_version: '14' } }
let(:with) { defined?(args) ? defaults.merge(args) : defaults }

if error
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/classes/database/postgresql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
{
read_database_username: params[:read_database_username],
database_name: params[:database_name],
password_hash: 'md588e898a4bade3fe1c9b96f650ec85900', # TODO: mock properly
password_hash: %r{^(md5|SCRAM)}, # TODO: mock properly
database_owner: params[:database_username],
}
end
Expand Down
Loading