From: Michael Orlitzky Date: Thu, 9 Jun 2022 11:33:07 +0000 (-0400) Subject: */*: drop tty parameters. X-Git-Tag: 0.0.5~1 X-Git-Url: http://gitweb.michael.orlitzky.com/?p=mailshears.git;a=commitdiff_plain;h=853aaef812f6e23f17d3e24db99dfbaadafdbddf */*: drop tty parameters. The "tty" parameter for postgresql connections has been ignored for as long as I can remember, but with postgresql-14, it has finally been removed. Now, attempting to supply it causes an error: PG::ConnectionBad: invalid connection option "tty" This commit removes all mention of the parameter, and updates two instances where PG::Connection.new() was called with positional arguments. Now it is called with a hash, sans the :tty key, which should be backwards-compatible. --- diff --git a/doc/mailshears.example.conf.yml b/doc/mailshears.example.conf.yml index 0764153..db516a0 100644 --- a/doc/mailshears.example.conf.yml +++ b/doc/mailshears.example.conf.yml @@ -4,7 +4,6 @@ plugins: [agendav, davical, dovecot, postfixadmin, roundcube] agendav_dbhost: localhost agendav_dbport: 5432 agendav_dbopts: -agendav_dbtty: agendav_dbuser: postgres agendav_dbpass: agendav_dbname: agendav @@ -12,7 +11,6 @@ agendav_dbname: agendav davical_dbhost: localhost davical_dbport: 5432 davical_dbopts: -davical_dbtty: davical_dbuser: postgres davical_dbpass: davical_dbname: davical @@ -22,7 +20,6 @@ dovecot_mail_root: /var/spool/mail/vhosts postfixadmin_dbhost: localhost postfixadmin_dbport: 5432 postfixadmin_dbopts: -postfixadmin_dbtty: postfixadmin_dbuser: postgres postfixadmin_dbpass: postfixadmin_dbname: postfixadmin @@ -30,7 +27,6 @@ postfixadmin_dbname: postfixadmin roundcube_dbhost: localhost roundcube_dbport: 5432 roundcube_dbopts: -roundcube_dbtty: roundcube_dbuser: postgres roundcube_dbpass: roundcube_dbname: roundcube diff --git a/doc/man1/mailshears.1 b/doc/man1/mailshears.1 index 286e5e0..7efe08f 100644 --- a/doc/man1/mailshears.1 +++ b/doc/man1/mailshears.1 @@ -165,9 +165,6 @@ on. Their meanings should be self-explanatory. \fI_dbopts\fR (default: empty) \# .IP \(bu -\fI_dbtty\fR (default: empty) -\# -.IP \(bu \fI_dbuser\fR (default: 'postgres') \# .IP \(bu diff --git a/lib/common/agendav_plugin.rb b/lib/common/agendav_plugin.rb index 3b3389d..187df6e 100644 --- a/lib/common/agendav_plugin.rb +++ b/lib/common/agendav_plugin.rb @@ -18,7 +18,6 @@ module AgendavPlugin :host => cfg.agendav_dbhost, :port => cfg.agendav_dbport, :options => cfg.agendav_dbopts, - :tty => cfg.agendav_dbtty, :dbname => cfg.agendav_dbname, :user => cfg.agendav_dbuser, :password => cfg.agendav_dbpass } diff --git a/lib/common/configuration.rb b/lib/common/configuration.rb index 02c30d2..738dc8c 100644 --- a/lib/common/configuration.rb +++ b/lib/common/configuration.rb @@ -79,7 +79,6 @@ class Configuration d['agendav_dbhost'] = 'localhost' d['agendav_dbport'] = 5432 d['agendav_dbopts'] = '' - d['agendav_dbtty'] = '' d['agendav_dbuser'] = 'postgres' d['agendav_dbpass'] = '' d['agendav_dbname'] = 'agendav' @@ -87,7 +86,6 @@ class Configuration d['davical_dbhost'] = 'localhost' d['davical_dbport'] = 5432 d['davical_dbopts'] = '' - d['davical_dbtty'] = '' d['davical_dbuser'] = 'postgres' d['davical_dbpass'] = '' d['davical_dbname'] = 'davical' @@ -97,7 +95,6 @@ class Configuration d['postfixadmin_dbhost'] = 'localhost' d['postfixadmin_dbport'] = 5432 d['postfixadmin_dbopts'] = '' - d['postfixadmin_dbtty'] = '' d['postfixadmin_dbuser'] = 'postgres' d['postfixadmin_dbpass'] = '' d['postfixadmin_dbname'] = 'postfixadmin' @@ -105,7 +102,6 @@ class Configuration d['roundcube_dbhost'] = 'localhost' d['roundcube_dbport'] = 5432 d['roundcube_dbopts'] = '' - d['roundcube_dbtty'] = '' d['roundcube_dbuser'] = 'postgres' d['roundcube_dbpass'] = '' d['roundcube_dbname'] = 'roundcube' diff --git a/lib/common/davical_plugin.rb b/lib/common/davical_plugin.rb index 06abbfa..2298a8e 100644 --- a/lib/common/davical_plugin.rb +++ b/lib/common/davical_plugin.rb @@ -18,7 +18,6 @@ module DavicalPlugin :host => cfg.davical_dbhost, :port => cfg.davical_dbport, :options => cfg.davical_dbopts, - :tty => cfg.davical_dbtty, :dbname => cfg.davical_dbname, :user => cfg.davical_dbuser, :password => cfg.davical_dbpass } diff --git a/lib/common/postfixadmin_plugin.rb b/lib/common/postfixadmin_plugin.rb index 92b7a5b..b4c9030 100644 --- a/lib/common/postfixadmin_plugin.rb +++ b/lib/common/postfixadmin_plugin.rb @@ -20,7 +20,6 @@ module PostfixadminPlugin :host => cfg.postfixadmin_dbhost, :port => cfg.postfixadmin_dbport, :options => cfg.postfixadmin_dbopts, - :tty => cfg.postfixadmin_dbtty, :dbname => cfg.postfixadmin_dbname, :user => cfg.postfixadmin_dbuser, :password => cfg.postfixadmin_dbpass } diff --git a/lib/common/roundcube_plugin.rb b/lib/common/roundcube_plugin.rb index 6d522bb..2ba9a98 100644 --- a/lib/common/roundcube_plugin.rb +++ b/lib/common/roundcube_plugin.rb @@ -19,7 +19,6 @@ module RoundcubePlugin :host => cfg.roundcube_dbhost, :port => cfg.roundcube_dbport, :options => cfg.roundcube_dbopts, - :tty => cfg.roundcube_dbtty, :dbname => cfg.roundcube_dbname, :user => cfg.roundcube_dbuser, :password => cfg.roundcube_dbpass } diff --git a/test/mailshears.test.conf.yml b/test/mailshears.test.conf.yml index 0bfbd7f..35df97c 100644 --- a/test/mailshears.test.conf.yml +++ b/test/mailshears.test.conf.yml @@ -4,7 +4,6 @@ plugins: [agendav, davical, dovecot, postfixadmin, roundcube] agendav_dbhost: localhost agendav_dbport: 5432 agendav_dbopts: -agendav_dbtty: agendav_dbuser: postgres agendav_dbpass: agendav_dbname: agendav_test @@ -12,7 +11,6 @@ agendav_dbname: agendav_test davical_dbhost: localhost davical_dbport: 5432 davical_dbopts: -davical_dbtty: davical_dbuser: postgres davical_dbpass: davical_dbname: davical_test @@ -22,7 +20,6 @@ dovecot_mail_root: /tmp/mailshears-test postfixadmin_dbhost: localhost postfixadmin_dbport: 5432 postfixadmin_dbopts: -postfixadmin_dbtty: postfixadmin_dbuser: postgres postfixadmin_dbpass: postfixadmin_dbname: postfixadmin_test @@ -30,7 +27,6 @@ postfixadmin_dbname: postfixadmin_test roundcube_dbhost: localhost roundcube_dbport: 5432 roundcube_dbopts: -roundcube_dbtty: roundcube_dbuser: postgres roundcube_dbpass: roundcube_dbname: roundcube_test diff --git a/test/mailshears_test.rb b/test/mailshears_test.rb index 94f2f49..22c634f 100644 --- a/test/mailshears_test.rb +++ b/test/mailshears_test.rb @@ -32,16 +32,15 @@ class MailshearsTest < MiniTest::Test # Connect to the database (specified in the test configuration) as # the superuser. Your local configuration is expected to be such # that this "just works." - db_host = 'localhost' - db_port = 5432 - db_opts = nil - db_tty = nil - db_name = 'postgres' - db_user = 'postgres' - db_pass = nil - - connection = PG::Connection.new(db_host, db_port, db_opts, db_tty, - db_name, db_user, db_pass) + db_hash = { + :host => 'localhost', + :port => 5432, + :options => nil, + :dbname => 'postgres', + :user => 'postgres', + :password => nil + } + connection = PG::Connection.new(db_hash) return connection end @@ -210,17 +209,16 @@ class MailshearsTest < MiniTest::Test query = "CREATE DATABASE #{plugin_dbname};" connection.sync_exec(query) - plugin_dbhost = cfg.send("#{plugin}_dbhost") - plugin_dbport = cfg.send("#{plugin}_dbport") - plugin_dbopts = cfg.send("#{plugin}_dbopts") - plugin_dbtty = cfg.send("#{plugin}_dbtty") - plugin_dbuser = cfg.send("#{plugin}_dbuser") - plugin_dbpass = cfg.send("#{plugin}_dbpass") + plugin_dbhash = { + :host => cfg.send("#{plugin}_dbhost"), + :port => cfg.send("#{plugin}_dbport"), + :options => cfg.send("#{plugin}_dbopts"), + :dbname => plugin_dbname, + :user => cfg.send("#{plugin}_dbuser"), + :password => cfg.send("#{plugin}_dbpass") + } - plugin_conn = PG::Connection.new(plugin_dbhost, plugin_dbport, - plugin_dbopts, plugin_dbtty, - plugin_dbname, plugin_dbuser, - plugin_dbpass) + plugin_conn = PG::Connection.new(plugin_dbhash) sql = File.open("test/sql/#{plugin}.sql").read() plugin_conn.sync_exec(sql)