@@ -112,7 +112,7 @@ def __enter__(self):
112112 def __exit__ (self , type , value , traceback ):
113113 self .free_port ()
114114
115- # NOTE: ctrl +C does not count!
115+ # NOTE: Ctrl +C does not count!
116116 got_exception = type is not None and type != KeyboardInterrupt
117117
118118 c1 = self .cleanup_on_good_exit and not got_exception
@@ -681,16 +681,13 @@ def psql(self,
681681 return process .returncode , out , err
682682
683683 @method_decorator (positional_args_hack (['dbname' , 'query' ]))
684- def safe_psql (self ,
685- query ,
686- dbname = None ,
687- username = None ,
688- input = None ):
684+ def safe_psql (self , query = None , ** kwargs ):
689685 """
690686 Execute a query using psql.
691687
692688 Args:
693689 query: query to be executed.
690+ filename: file with a query.
694691 dbname: database name to connect to.
695692 username: database user name.
696693 input: raw input to be passed.
@@ -699,10 +696,7 @@ def safe_psql(self,
699696 psql's output as str.
700697 """
701698
702- ret , out , err = self .psql (query = query ,
703- dbname = dbname ,
704- username = username ,
705- input = input )
699+ ret , out , err = self .psql (query = query , ** kwargs )
706700 if ret :
707701 raise QueryException ((err or b'' ).decode ('utf-8' ), query )
708702
@@ -858,37 +852,34 @@ def execute(self,
858852
859853 return res
860854
861- def backup (self , username = None , xlog_method = DEFAULT_XLOG_METHOD ):
855+ def backup (self , ** kwargs ):
862856 """
863857 Perform pg_basebackup.
864858
865859 Args:
866860 username: database user name.
867861 xlog_method: a method for collecting the logs ('fetch' | 'stream').
862+ base_dir: the base directory for data files and logs
868863
869864 Returns:
870865 A smart object of type NodeBackup.
871866 """
872867
873868 from .backup import NodeBackup
874- return NodeBackup (node = self ,
875- username = username ,
876- xlog_method = xlog_method )
869+ return NodeBackup (node = self , ** kwargs )
877870
878- def replicate (self ,
879- name = None ,
880- username = None ,
881- xlog_method = DEFAULT_XLOG_METHOD ):
871+ def replicate (self , name = None , ** kwargs ):
882872 """
883873 Create a binary replica of this node.
884874
885875 Args:
886876 name: replica's application name.
887877 username: database user name.
888878 xlog_method: a method for collecting the logs ('fetch' | 'stream').
879+ base_dir: the base directory for data files and logs
889880 """
890881
891- backup = self .backup (username = username , xlog_method = xlog_method )
882+ backup = self .backup (** kwargs )
892883
893884 # transform backup into a replica
894885 return backup .spawn_replica (name = name , destroy = True )
0 commit comments