From a2c6ed55044911e598ff24b939fcd27e33a64a67 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Mon, 23 Jul 2018 20:42:33 +0200 Subject: [PATCH] async is a keyword in python3.7 (#751) * async is a keyword in python3.7 Setting up patroni (1.4.4-1) ... File "/usr/lib/python3/dist-packages/patroni/ha.py", line 610 'offline': dict(stop='fast', checkpoint=False, release=False, offline=True, async=False), ^ SyntaxError: invalid syntax Fix #750 by replacing dict member "async" with "async_req". * requirements.txt: Update for new kubernetes version compatible with 3.7 --- patroni/ha.py | 10 +++++----- requirements.txt | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/patroni/ha.py b/patroni/ha.py index 0b4f8299..eaf16e72 100644 --- a/patroni/ha.py +++ b/patroni/ha.py @@ -597,10 +597,10 @@ class Ha(object): PostgreSQL as quickly as possible without regard for data durability. May only be called synchronously. """ mode_control = { - 'offline': dict(stop='fast', checkpoint=False, release=False, offline=True, async=False), - 'graceful': dict(stop='fast', checkpoint=True, release=True, offline=False, async=False), - 'immediate': dict(stop='immediate', checkpoint=False, release=True, offline=False, async=True), - 'immediate-nolock': dict(stop='immediate', checkpoint=False, release=False, offline=False, async=True), + 'offline': dict(stop='fast', checkpoint=False, release=False, offline=True, async_req=False), + 'graceful': dict(stop='fast', checkpoint=True, release=True, offline=False, async_req=False), + 'immediate': dict(stop='immediate', checkpoint=False, release=True, offline=False, async_req=True), + 'immediate-nolock': dict(stop='immediate', checkpoint=False, release=False, offline=False, async_req=True), }[mode] self.state_handler.trigger_check_diverged_lsn() @@ -620,7 +620,7 @@ class Ha(object): # FIXME: with mode offline called from DCS exception handler and handle_long_action_in_progress # there could be an async action already running, calling follow from here will lead # to racy state handler state updates. - if mode_control['async']: + if mode_control['async_req']: self._async_executor.schedule('starting after demotion') self._async_executor.run_async(self.state_handler.follow, (node_to_follow,)) else: diff --git a/requirements.txt b/requirements.txt index 45d5bcde..5684f0b7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,4 +13,4 @@ tzlocal python-dateutil psutil cdiff -kubernetes>=2.0.0,<=6.0.0,!=4.0.*,!=5.0.* +kubernetes>=2.0.0,<=7.0.0,!=4.0.*,!=5.0.*