|
24 | 24 | import os
|
25 | 25 | import subprocess
|
26 | 26 | import pwd
|
27 |
| -import tempfile |
28 | 27 | import shutil
|
29 | 28 | import time
|
30 | 29 | import six
|
|
49 | 48 | bound_ports = set()
|
50 | 49 | registered_nodes = []
|
51 | 50 | util_threads = []
|
| 51 | +base_data_dir = None |
52 | 52 | tmp_dirs = []
|
53 | 53 | pg_config_data = {}
|
54 |
| -base_data_dir = None |
55 | 54 |
|
56 | 55 |
|
57 | 56 | class ClusterException(Exception):
|
@@ -87,8 +86,8 @@ def __str__(self):
|
87 | 86 |
|
88 | 87 | class LogWriter(threading.Thread):
|
89 | 88 | '''
|
90 |
| - Helper class to implement reading from postgresql.log and redirect |
91 |
| - it python logging |
| 89 | + Helper class to implement reading from postgresql.log |
| 90 | + and redirect it python logging |
92 | 91 | '''
|
93 | 92 |
|
94 | 93 | def __init__(self, node_name, fd):
|
@@ -328,8 +327,6 @@ def init(self, allows_streaming=False, initdb_params=[]):
|
328 | 327 | "log_statement = all\n"
|
329 | 328 | "port = {}\n".format(self.port))
|
330 | 329 | conf.write(
|
331 |
| - # "unix_socket_directories = '%s'\n" |
332 |
| - # "listen_addresses = ''\n";) |
333 | 330 | "listen_addresses = '{}'\n".format(self.host))
|
334 | 331 |
|
335 | 332 | if allows_streaming:
|
@@ -451,7 +448,8 @@ def status(self):
|
451 | 448 | If there is no data in data_dir or data_dir do not exists - return None
|
452 | 449 | """
|
453 | 450 | try:
|
454 |
| - res = subprocess.check_output([ |
| 451 | + # TODO: use result? |
| 452 | + subprocess.check_output([ |
455 | 453 | self.get_bin_path("pg_ctl"), 'status', '-D',
|
456 | 454 | '{0}'.format(self.data_dir)
|
457 | 455 | ])
|
@@ -732,6 +730,9 @@ def get_new_node(name, base_dir=None, use_logging=False):
|
732 | 730 |
|
733 | 731 | def clean_all():
|
734 | 732 | global registered_nodes
|
| 733 | + global base_data_dir |
| 734 | + global tmp_dirs |
| 735 | + |
735 | 736 | for node in registered_nodes:
|
736 | 737 | node.cleanup()
|
737 | 738 |
|
|
0 commit comments