diff --git a/debian/changelog b/debian/changelog index 22a3ca3..4a5bb3e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,9 @@ patroni (1.6.1-1) UNRELEASED; urgency=medium * New upstream release. [ Michael Banck ] + * debian/patches/check_postmaster.patch: Refreshed. + * debian/patches/avoid_distutils_spawn.patch: Removed, no longer needed. + * debian/patches/disable_postgresql.conf_chmod.patch: Likewise. * debian/pg_createconfig_patroni: Add --vip option and write out a vip-manager configuration if present. * debian/config.yml.in: Add @LISTEN_VIP@ tag. diff --git a/debian/patches/avoid_distutils_spawn.patch b/debian/patches/avoid_distutils_spawn.patch deleted file mode 100644 index 30a7016..0000000 --- a/debian/patches/avoid_distutils_spawn.patch +++ /dev/null @@ -1,71 +0,0 @@ -commit 0a1d9b0a251b70df7eb4b4004c86e169cddd8ed1 -Author: Alexander Kukushkin -Date: Mon Aug 26 09:38:47 2019 +0200 - - Get rid from distutils module dependency (#1146) - - We are using only one function from there, `find_executable()` and it is better to implement a similar function in Patroni rather than add `distutils` module into requirements.txt - -Index: patroni/patroni/ctl.py -=================================================================== ---- patroni.orig/patroni/ctl.py -+++ patroni/patroni/ctl.py -@@ -25,7 +25,6 @@ import yaml - - from click import ClickException - from contextlib import contextmanager --from distutils.spawn import find_executable - from patroni.config import Config - from patroni.dcs import get_dcs as _get_dcs - from patroni.exceptions import PatroniException -@@ -1106,6 +1105,24 @@ def apply_yaml_file(data, filename): - return format_config_for_editing(changed_data), changed_data - - -+def find_executable(executable, path=None): -+ _, ext = os.path.splitext(executable) -+ -+ if (sys.platform == 'win32') and (ext != '.exe'): -+ executable = executable + '.exe' -+ -+ if os.path.isfile(executable): -+ return executable -+ -+ if path is None: -+ path = os.environ.get('PATH', os.defpath) -+ -+ for p in path.split(os.pathsep): -+ f = os.path.join(p, executable) -+ if os.path.isfile(f): -+ return f -+ -+ - def invoke_editor(before_editing, cluster_name): - """Starts editor command to edit configuration in human readable format - -Index: patroni/tests/test_ctl.py -=================================================================== ---- patroni.orig/tests/test_ctl.py -+++ patroni/tests/test_ctl.py -@@ -9,7 +9,7 @@ from datetime import datetime, timedelta - from mock import patch, Mock - from patroni.ctl import ctl, store_config, load_config, output_members, request_patroni, get_dcs, parse_dcs, \ - get_all_members, get_any_member, get_cursor, query_member, configure, PatroniCtlException, apply_config_changes, \ -- format_config_for_editing, show_diff, invoke_editor, format_pg_version -+ format_config_for_editing, show_diff, invoke_editor, format_pg_version, find_executable - from patroni.dcs.etcd import Client, Failover - from patroni.utils import tzutc - from psycopg2 import OperationalError -@@ -587,3 +587,12 @@ class TestCtl(unittest.TestCase): - def test_format_pg_version(self): - self.assertEqual(format_pg_version(100001), '10.1') - self.assertEqual(format_pg_version(90605), '9.6.5') -+ -+ @patch('sys.platform', 'win32') -+ def test_find_executable(self): -+ with patch('os.path.isfile', Mock(return_value=True)): -+ self.assertEqual(find_executable('vim'), 'vim.exe') -+ with patch('os.path.isfile', Mock(return_value=False)): -+ self.assertIsNone(find_executable('vim')) -+ with patch('os.path.isfile', Mock(side_effect=[False, True])): -+ self.assertEqual(find_executable('vim', '/'), '/vim.exe') diff --git a/debian/patches/check_postmaster.patch b/debian/patches/check_postmaster.patch index dab788d..963950a 100644 --- a/debian/patches/check_postmaster.patch +++ b/debian/patches/check_postmaster.patch @@ -1,8 +1,8 @@ -Index: patroni/patroni/postmaster.py +Index: patroni/patroni/postgresql/postmaster.py =================================================================== --- patroni.orig/patroni/postgresql/postmaster.py -+++ patroni/postgresql/patroni/postmaster.py -@@ -50,14 +50,15 @@ class PostmasterProcess(psutil.Process): ++++ patroni/patroni/postgresql/postmaster.py +@@ -52,14 +52,15 @@ class PostmasterProcess(psutil.Process): return {} def _is_postmaster_process(self): diff --git a/debian/patches/disable_postgresql.conf_chmod.patch b/debian/patches/disable_postgresql.conf_chmod.patch deleted file mode 100644 index 3c96e15..0000000 --- a/debian/patches/disable_postgresql.conf_chmod.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ./patroni/postgresql/config.py.orig 2019-09-20 19:35:58.418475569 +0200 -+++ ./patroni/postgresql/config.py 2019-09-20 19:36:13.614584041 +0200 -@@ -284,7 +284,6 @@ - os.rename(self._postgresql_conf, self._postgresql_base_conf) - - with open(self._postgresql_conf, 'w') as f: -- os.chmod(self._postgresql_conf, stat.S_IWRITE | stat.S_IREAD) - f.write(self._CONFIG_WARNING_HEADER) - f.write("include '{0}'\n\n".format(self._config.get('custom_conf') or self._postgresql_base_conf_name)) - for name, value in sorted((configuration or self._server_parameters).items()): diff --git a/debian/patches/series b/debian/patches/series index 1624c0a..c954db4 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -2,6 +2,4 @@ startup_scripts.patch consul_import.patch check_postmaster.patch acceptance_tests_system_patroni.patch -disable_postgresql.conf_chmod.patch acceptance_tests_timeouts.patch -avoid_distutils_spawn.patch