[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v4 01/11] osstest: allow to disable the usage of a know_host file



This is only used by target_cmd_root and target_putfile_root and will be
needed for mfsBSD which generates new keys on each boot.

Signed-off-by: Roger Pau Monnà <roger.pau@xxxxxxxxxx>
Cc: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 Osstest/TestSupport.pm | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 5ac66e5..d930e55 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -374,14 +374,21 @@ sub remote_perl_script_done ($) {
 
 sub sshuho ($$) { my ($user,$ho)= @_; return "$user\@$ho->{Ip}"; }
 
-sub sshopts () {
+sub sshopts {
+    my ($disable_hosts) = @_;
+    my $hosts = "tmp/t.known_hosts_$flight.$job";
+
+    if (defined $disable_hosts) {
+        $hosts = "/dev/null";
+    }
+
     return [ qw(-o StrictHostKeyChecking=no
                 -o BatchMode=yes
                 -o ConnectTimeout=100
                 -o ServerAliveInterval=100
                 -o PasswordAuthentication=no
                 -o ChallengeResponseAuthentication=no),
-             '-o', "UserKnownHostsFile=tmp/t.known_hosts_$flight.$job"
+             '-o', "UserKnownHostsFile=$hosts"
              ];
 }
 
@@ -412,16 +419,16 @@ sub target_getfile_root ($$$$) {
 }
 
 sub tputfileex {
-    my ($ruser, $ho,$timeout, $lsrc,$rdst, $rsync) = @_;
+    my ($ruser, $ho,$timeout, $lsrc,$rdst, $rsync, $disable_hosts) = @_;
     my @args= ($lsrc, sshuho($ruser,$ho).":$rdst");
     if (!defined $rsync) {
         tcmdex($timeout,undef,
-               'scp', sshopts(),
+               'scp', sshopts($disable_hosts),
                @args);
     } else {
         unshift @args, $rsync if length $rsync;
         tcmdex($timeout,undef,
-               'rsync', [ '-e', 'ssh '.join(' ',@{ sshopts() }) ],
+               'rsync', [ '-e', 'ssh '.join(' ',@{ sshopts($disable_hosts) }) 
],
                @args);
     }
 }
@@ -429,7 +436,7 @@ sub target_putfile ($$$$;$) {
     # $ho,$timeout,$lsrc,$rdst,[$rsync_opt]
     tputfileex('osstest', @_);
 }
-sub target_putfile_root ($$$$;$) {
+sub target_putfile_root ($$$$;$$) {
     tputfileex('root', @_);
 }
 sub target_run_apt {
@@ -569,14 +576,14 @@ sub target_await_down ($$) {
 }    
 
 sub tcmd { # $tcmd will be put between '' but not escaped
-    my ($stdout,$user,$ho,$tcmd,$timeout) = @_;
+    my ($stdout,$user,$ho,$tcmd,$timeout,$disable_hosts) = @_;
     $timeout=30 if !defined $timeout;
     tcmdex($timeout,$stdout,
-           'ssh', sshopts(),
+           'ssh', sshopts($disable_hosts),
            sshuho($user,$ho), $tcmd);
 }
 sub target_cmd ($$;$) { tcmd(undef,'osstest',@_); }
-sub target_cmd_root ($$;$) { tcmd(undef,'root',@_); }
+sub target_cmd_root ($$;$$) { tcmd(undef,'root',@_); }
 
 sub tcmdout {
     my $stdout= IO::File::new_tmpfile();
-- 
1.9.3 (Apple Git-50)


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.