diff --git a/patroni/ctl.py b/patroni/ctl.py index ffc9fc11..1023a6d7 100644 --- a/patroni/ctl.py +++ b/patroni/ctl.py @@ -24,7 +24,6 @@ import yaml from click import ClickException from contextlib import contextmanager -from patroni.config import Config from patroni.dcs import get_dcs as _get_dcs from patroni.exceptions import PatroniException from patroni.postgresql import Postgresql @@ -67,6 +66,8 @@ def parse_dcs(dcs): def load_config(path, dcs): + from patroni.config import Config + if not (os.path.exists(path) and os.access(path, os.R_OK)): logging.debug('Ignoring configuration file "%s". It does not exists or is not readable.', path) else: diff --git a/patroni/postgresql/postmaster.py b/patroni/postgresql/postmaster.py index 855c25f0..a6807a93 100644 --- a/patroni/postgresql/postmaster.py +++ b/patroni/postgresql/postmaster.py @@ -6,6 +6,8 @@ import re import signal import subprocess +from patroni.config import Config + logger = logging.getLogger(__name__) STOP_SIGNALS = { @@ -153,7 +155,7 @@ class PostmasterProcess(psutil.Process): # In order to make everything portable we can't use fork&exec approach here, so we will call # ourselves and pass list of arguments which must be used to start postgres. # On Windows, in order to run a side-by-side assembly the specified env must include a valid SYSTEMROOT. - env = {p: os.environ[p] for p in ('PATH', 'LD_LIBRARY_PATH', 'LC_ALL', 'LANG', 'SYSTEMROOT') if p in os.environ} + env = {p: os.environ[p] for p in os.environ if not p.startswith(Config.PATRONI_ENV_PREFIX)} try: proc = PostmasterProcess._from_pidfile(data_dir) if proc and not proc._is_postmaster_process():