@@ -843,7 +843,7 @@ def copy_file(self, local_file, remote_file, recurse=False):
843843 {'recurse' : recurse })
844844 for host in self .hosts ]
845845
846- def _copy_file (self , host , local_file , remote_file , recurse = False ):
846+ def _copy_file (self , host , local_file , remote_file , recurse ):
847847 """Make sftp client, copy file"""
848848 if not host in self .host_clients or not self .host_clients [host ]:
849849 _user , _port , _password , _pkey = self ._get_host_config_values (host )
@@ -856,16 +856,17 @@ def _copy_file(self, host, local_file, remote_file, recurse=False):
856856 proxy_port = self .proxy_port ,
857857 agent = self .agent ,
858858 channel_timeout = self .channel_timeout )
859- return self .host_clients [host ].copy_file (local_file , remote_file ,
859+ return self .host_clients [host ].copy_file (local_file , remote_file , recurse = recurse )
860860
861- def copy_file_to_local (self , remote_file , local_file ):
861+ def copy_file_to_local (self , remote_file , local_file , recurse = False ):
862862 """Copy remote file to local file in parallel
863863
864864 :param remote_file: remote filepath to copy to local host
865865 :type remote_file: str
866866 :param local_file: local filepath on local host to copy file to
867867 :type local_file: str
868-
868+ :param recurse: whether or not to recurse
869+ :type recurse: bool
869870 .. note ::
870871 Local directories in `local_file` that do not exist will be
871872 created as long as permissions allow.
@@ -877,14 +878,14 @@ def copy_file_to_local(self, remote_file, local_file):
877878 :rtype: List(:mod:`gevent.Greenlet`) of greenlets for remote copy \
878879 commands
879880 """
880- return [self .pool .spawn (self ._copy_file_to_local , host , remote_file , local_file )
881+ return [self .pool .spawn (self ._copy_file_to_local , host , remote_file , local_file , recurse )
881882 for host in self .hosts ]
882883
883- def _copy_file_to_local (self , host , remote_file , local_file ):
884+ def _copy_file_to_local (self , host , remote_file , local_file , recurse ):
884885 """Make sftp client, copy file to local"""
885886 if not self .host_clients [host ]:
886887 self .host_clients [host ] = SSHClient (host , user = self .user ,
887888 password = self .password ,
888889 port = self .port , pkey = self .pkey ,
889890 forward_ssh_agent = self .forward_ssh_agent )
890- return self .host_clients [host ].copy_file_to_local (remote_file , '_' .join ([local_file , host ]))
891+ return self .host_clients [host ].copy_file_to_local (remote_file , '_' .join ([local_file , host ]), recurse = recurse )
0 commit comments