summaryrefslogtreecommitdiff
path: root/client/utils/cluster.py
diff options
context:
space:
mode:
authorMark Wong2017-07-27 00:51:59 +0000
committerMark Wong2018-01-05 16:11:28 +0000
commit912fa3cc5ccc599a6f8f90ae429f91e828e559a2 (patch)
treeda8779d672d99d4e84540fba0db7ee904e65b2af /client/utils/cluster.py
parentaf9c1ef86dfa9fe22cbed192eb64e8022c0ea5a8 (diff)
Fix use of env in call()
The env parameter to call() was clearing the PATH environment to only have the postgres binary install path. Modify only the PATH environment.
Diffstat (limited to 'client/utils/cluster.py')
-rw-r--r--client/utils/cluster.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/client/utils/cluster.py b/client/utils/cluster.py
index d16d91d..81bca89 100644
--- a/client/utils/cluster.py
+++ b/client/utils/cluster.py
@@ -15,6 +15,9 @@ class PgCluster(object):
self._bin = bin_path
self._data = data_path
+ self._env = os.environ
+ self._env['PATH'] = ':'.join([bin_path, self._env['PATH']])
+
self._options = ""
def _initdb(self):
@@ -22,7 +25,7 @@ class PgCluster(object):
with TemporaryFile() as strout:
log("initializing cluster into '%s'" % (self._data,))
- call(['pg_ctl', '-D', self._data, 'init'], env={'PATH': self._bin},
+ call(['pg_ctl', '-D', self._data, 'init'], env=self._env,
stdout=strout, stderr=STDOUT)
def _configure(self, config):
@@ -62,7 +65,7 @@ class PgCluster(object):
if len(self._options) > 0:
cmd.extend(['-o', self._options])
cmd.append('start')
- call(cmd, env={'PATH': self._bin}, stdout=strout, stderr=STDOUT)
+ call(cmd, env=self._env, stdout=strout, stderr=STDOUT)
def stop(self, destroy=True):
'stop the cluster'
@@ -71,7 +74,7 @@ class PgCluster(object):
log("stopping cluster in '%s' using '%s' binaries" %
(self._data, self._bin))
call(['pg_ctl', '-D', self._data, '-w', '-t', '60', 'stop'],
- env={'PATH': self._bin}, stdout=strout, stderr=STDOUT)
+ env=self._env, stdout=strout, stderr=STDOUT)
# kill any remaining processes, remove the data dir
if destroy: