rename myplc-native into plain myplc and old-fashioned myplc into myplc-chroot
[tests.git] / system / TestSsh.py
index 6f11344..d881cf8 100644 (file)
@@ -55,7 +55,7 @@ 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:
@@ -153,8 +153,13 @@ class TestSsh:
             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)
-        utils.system(command)
+            # 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
     # convenience only
@@ -163,5 +168,5 @@ class TestSsh:
     def clear_known_hosts (self):
         known_hosts = "%s/.ssh/known_hosts"%os.getenv("HOME")
         utils.header("Clearing entry for %s in %s"%(self.hostname,known_hosts))
-        utils.system("sed -i -e /^%s/d %s"%(self.hostname,known_hosts))
+        return utils.system("sed -i -e /^%s/d %s"%(self.hostname,known_hosts))