File tree 2 files changed +21
-8
lines changed
2 files changed +21
-8
lines changed Original file line number Diff line number Diff line change @@ -7,3 +7,5 @@ ${PYTHON} -m unittest test_simple
7
7
8
8
cd ../..
9
9
flake8 --ignore=W191,F401,E501,F403 .
10
+
11
+ cd ../..
Original file line number Diff line number Diff line change @@ -421,24 +421,35 @@ def start(self, params={}):
421
421
""" Starts cluster """
422
422
423
423
if self .use_logging :
424
- tmpfile = tempfile .NamedTemporaryFile (
425
- 'w' , dir = self .logs_dir , delete = False )
426
- logfile = tmpfile .name
424
+ tmpfile = tempfile .NamedTemporaryFile ('w' , dir = self .logs_dir , delete = False )
425
+ log_filename = tmpfile .name
427
426
428
- self .logger = log_watch (self .name , logfile )
427
+ self .logger = log_watch (self .name , log_filename )
429
428
else :
430
- logfile = os .path .join (self .logs_dir , "postgresql.log" )
429
+ log_filename = os .path .join (self .logs_dir , "postgresql.log" )
431
430
432
431
_params = {
433
432
"-D" : self .data_dir ,
434
433
"-w" : None ,
435
- "-l" : logfile ,
434
+ "-l" : log_filename ,
436
435
}
437
436
_params .update (params )
438
- self .pg_ctl ("start" , _params )
437
+ try :
438
+ self .pg_ctl ("start" , _params )
439
+ except ClusterException as e :
440
+ print ("\n pg_ctl log:\n ----" )
441
+ print (str (e ))
442
+ if os .path .exists (log_filename ):
443
+ print ("\n postgresql.log:\n ----" )
444
+ with open (log_filename , 'r' ) as logfile :
445
+ text = logfile .readlines ()[- 1 ]
446
+ print (text )
447
+ else :
448
+ print ("Log file not found: %s" , log_filename )
439
449
440
- self . working = True
450
+ raise ClusterException ( "Couldn't start the new node" )
441
451
452
+ self .working = True
442
453
return self
443
454
444
455
def status (self ):
You can’t perform that action at this time.
0 commit comments