From 98321c4d891aaaaf2dcf681fd9b9edd53d26393f Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 30 Aug 2023 22:28:54 +0200 Subject: [PATCH] Drop postgresql 8.1/RHEL5 specific code --- manifests/globals.pp | 2 -- manifests/server/database.pp | 20 +++++--------------- manifests/server/instance/config.pp | 9 --------- manifests/server/pg_hba_rule.pp | 1 - spec/acceptance/db_spec.rb | 8 ++------ spec/acceptance/server/grant_role_spec.rb | 19 ------------------- spec/acceptance/server/schema_spec.rb | 11 ----------- 7 files changed, 7 insertions(+), 63 deletions(-) diff --git a/manifests/globals.pp b/manifests/globals.pp index d04dda7e47..e3e81ae9f6 100644 --- a/manifests/globals.pp +++ b/manifests/globals.pp @@ -196,7 +196,6 @@ '8' => '10', '7' => '9.2', '6' => '8.4', - '5' => '8.1', default => undef, }, }, @@ -248,7 +247,6 @@ } $default_postgis_version = $globals_version ? { - '8.1' => '1.3.6', '8.4' => '2.0', '9.0' => '2.1', '9.1' => '2.1', diff --git a/manifests/server/database.pp b/manifests/server/database.pp index 27e49e2eab..fc7fede53b 100644 --- a/manifests/server/database.pp +++ b/manifests/server/database.pp @@ -52,16 +52,11 @@ # Optionally set the locale switch. Older versions of createdb may not accept # --locale, so if the parameter is undefined its safer not to pass it. - if ($version != '8.1') { - $locale_option = $locale ? { - undef => '', - default => "LC_COLLATE = '${locale}' LC_CTYPE = '${locale}'", - } - $public_revoke_privilege = 'CONNECT' - } else { - $locale_option = '' - $public_revoke_privilege = 'ALL' + $locale_option = $locale ? { + undef => '', + default => "LC_COLLATE = '${locale}' LC_CTYPE = '${locale}'", } + $public_revoke_privilege = 'CONNECT' $template_option = $template ? { undef => '', @@ -96,14 +91,9 @@ } if $comment { - # The shobj_description function was only introduced with 8.2 - $comment_information_function = $version ? { - '8.1' => 'obj_description', - default => 'shobj_description', - } Postgresql_psql["CREATE DATABASE \"${dbname}\""] -> postgresql_psql { "COMMENT ON DATABASE \"${dbname}\" IS '${comment}'": - unless => "SELECT 1 FROM pg_catalog.pg_database d WHERE datname = '${dbname}' AND pg_catalog.${comment_information_function}(d.oid, 'pg_database') = '${comment}'", # lint:ignore:140chars + unless => "SELECT 1 FROM pg_catalog.pg_database d WHERE datname = '${dbname}' AND pg_catalog.shobj_description(d.oid, 'pg_database') = '${comment}'", # lint:ignore:140chars db => $dbname, } } diff --git a/manifests/server/instance/config.pp b/manifests/server/instance/config.pp index 3eeb855a6a..a0d7b0df49 100644 --- a/manifests/server/instance/config.pp +++ b/manifests/server/instance/config.pp @@ -89,24 +89,16 @@ user => 'all', } - # Lets setup the base rules - $local_auth_option = $version ? { - '8.1' => 'sameuser', - default => undef, - } - postgresql::server::pg_hba_rule { "local access as postgres user for instance ${name}": type => 'local', user => $user, auth_method => 'ident', - auth_option => $local_auth_option, order => 1; "local access to database with same name for instance ${name}": type => 'local', auth_method => 'ident', - auth_option => $local_auth_option, order => 2; "allow localhost TCP access to postgresql user for instance ${name}": @@ -174,7 +166,6 @@ } else { $package_name = $facts['os']['release']['major'] ? { - '5' => 'policycoreutils', '6' => 'policycoreutils-python', '7' => 'policycoreutils-python', default => 'policycoreutils-python-utils', diff --git a/manifests/server/pg_hba_rule.pp b/manifests/server/pg_hba_rule.pp index ffcb9b03da..24717b232c 100644 --- a/manifests/server/pg_hba_rule.pp +++ b/manifests/server/pg_hba_rule.pp @@ -72,7 +72,6 @@ '8.4' => ['trust', 'reject', 'md5', 'password', 'gss', 'sspi', 'krb5', 'ident', 'ldap', 'cert', 'pam'], '8.3' => ['trust', 'reject', 'md5', 'crypt', 'password', 'gss', 'sspi', 'krb5', 'ident', 'ldap', 'pam'], '8.2' => ['trust', 'reject', 'md5', 'crypt', 'password', 'krb5', 'ident', 'ldap', 'pam'], - '8.1' => ['trust', 'reject', 'md5', 'crypt', 'password', 'krb5', 'ident', 'pam'], default => ['trust', 'reject', 'scram-sha-256', 'md5', 'password', 'gss', 'sspi', 'krb5', 'ident', 'peer', 'ldap', 'radius', 'cert', 'pam', 'crypt', 'bsd'] # lint:ignore:140chars } diff --git a/spec/acceptance/db_spec.rb b/spec/acceptance/db_spec.rb index 51fe5825af..2564aaedf5 100644 --- a/spec/acceptance/db_spec.rb +++ b/spec/acceptance/db_spec.rb @@ -37,12 +37,8 @@ class { 'postgresql::server': result = psql('--command="SELECT 1 FROM pg_roles WHERE rolname=\'test-user\'"') expect(result.stdout).to match(%r{\(1 row\)}) - comment_information_function = if Gem::Version.new(postgresql_version) > Gem::Version.new('8.1') - 'shobj_description' - else - 'obj_description' - end - result = psql("--dbname postgresql-test-db --command=\"SELECT pg_catalog.#{comment_information_function}(d.oid, 'pg_database') FROM pg_catalog.pg_database d WHERE datname = 'postgresql-test-db' AND pg_catalog.#{comment_information_function}(d.oid, 'pg_database') = 'testcomment'\"") # rubocop:disable Layout/LineLength + + result = psql("--dbname postgresql-test-db --command=\"SELECT pg_catalog.shobj_description(d.oid, 'pg_database') FROM pg_catalog.pg_database d WHERE datname = 'postgresql-test-db' AND pg_catalog.shobj_description(d.oid, 'pg_database') = 'testcomment'\"") # rubocop:disable Layout/LineLength expect(result.stdout).to match(%r{\(1 row\)}) ensure psql('--command=\'drop database "postgresql-test-db"\'') diff --git a/spec/acceptance/server/grant_role_spec.rb b/spec/acceptance/server/grant_role_spec.rb index 6a32dc03e8..246328e23f 100644 --- a/spec/acceptance/server/grant_role_spec.rb +++ b/spec/acceptance/server/grant_role_spec.rb @@ -7,16 +7,12 @@ let(:user) { 'psql_grant_role_tester' } let(:group) { 'test_group' } let(:password) { 'psql_grant_role_pw' } - let(:version) do - '8.1' if os[:family] == 'redhat' && os[:release].start_with?('5') - end let(:pp_one) do <<-MANIFEST.unindent $db = #{db} $user = #{user} $group = #{group} $password = #{password} - $version = '#{version}' class { 'postgresql::server': } @@ -34,19 +30,12 @@ class { 'postgresql::server': } require => Postgresql::Server::Role[$user], } - # Lets setup the base rules - $local_auth_option = $version ? { - '8.1' => 'sameuser', - default => undef, - } - # Create a rule for the user postgresql::server::pg_hba_rule { "allow ${user}": type => 'local', database => $db, user => $user, auth_method => 'ident', - auth_option => $local_auth_option, order => 1, } @@ -70,7 +59,6 @@ class { 'postgresql::server': } $user = "#{user}" $group = "#{group}" $password = #{password} - $version = '#{version}' class { 'postgresql::server': } @@ -88,19 +76,12 @@ class { 'postgresql::server': } require => Postgresql::Server::Role[$user], } - # Lets setup the base rules - $local_auth_option = $version ? { - '8.1' => 'sameuser', - default => undef, - } - # Create a rule for the user postgresql::server::pg_hba_rule { "allow ${user}": type => 'local', database => $db, user => $user, auth_method => 'ident', - auth_option => $local_auth_option, order => 1, } diff --git a/spec/acceptance/server/schema_spec.rb b/spec/acceptance/server/schema_spec.rb index dc2bc5d6c3..250ffeca81 100644 --- a/spec/acceptance/server/schema_spec.rb +++ b/spec/acceptance/server/schema_spec.rb @@ -3,15 +3,11 @@ require 'spec_helper_acceptance' describe 'postgresql::server::schema:' do - let(:version) do - '8.1' if os[:family] == 'redhat' && os[:release].start_with?('5') - end let(:pp) do <<-MANIFEST.unindent $db = 'schema_test' $user = 'psql_schema_tester' $password = 'psql_schema_pw' - $version = '#{version}' class { 'postgresql::server': } @@ -29,19 +25,12 @@ class { 'postgresql::server': } require => Postgresql::Server::Role[$user], } - # Lets setup the base rules - $local_auth_option = $version ? { - '8.1' => 'sameuser', - default => undef, - } - # Create a rule for the user postgresql::server::pg_hba_rule { "allow ${user}": type => 'local', database => $db, user => $user, auth_method => 'ident', - auth_option => $local_auth_option, order => 1, }