import os.path
import utils
+import shutil
class TestSsh:
def is_local(self):
return TestSsh.is_local_hostname(self.hostname)
- std_options="-o StrictHostKeyChecking=no -o BatchMode=yes "
+ std_options="-o BatchMode=yes -o StrictHostKeyChecking=no -o CheckHostIP=no -o ConnectTimeout=5 -o UserKnownHostsFile=/dev/null "
def key_part (self):
if not self.key:
dirname=self.buildname
return self.run("mkdir -p %s"%dirname)
+ def rmdir (self,dirname=None):
+ if self.is_local():
+ if dirname:
+ return shutil.rmtree(dirname)
+ return 0
+ if dirname:
+ dirname="%s/%s"%(self.buildname,dirname)
+ else:
+ dirname=self.buildname
+ return self.run("rm -rf %s"%dirname)
+
def create_buildname_once (self):
if self.is_local():
return
command += TestSsh.std_options
if recursive: command += "-r "
command += self.key_part()
- command += "%s:%s/%s %s"%(self.hostname_part(),self.buildname,remote_file,local_file)
+ # absolute path - do not preprend buildname
+ if remote_file.find("/")==0:
+ remote_path=remote_file
+ else:
+ remote_path="%s/%s"%(self.buildname,remote_file)
+ command += "%s:%s %s"%(self.hostname_part(),remote_path,local_file)
return utils.system(command)
# this is only to avoid harmless message when host cannot be identified