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

[OSSTEST PATCH 2/3] known hosts handling: Ensure things are good for multi-host jobs



When a multi-host job reuses host(s) from earlier jobs, the set of
hosts set up in the on-host known_hosts files may be insufficient,
since the hosts we are using now may not have been in any of the
flight's runvars when the earlier job set them up.

So we need to update the known_hosts.  We use the flight's current
set, which will include all of our hosts.

Signed-off-by: Ian Jackson <iwj@xxxxxxxxxxxxxx>
---
 ts-host-reuse | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/ts-host-reuse b/ts-host-reuse
index 8d674257..ea8a471d 100755
--- a/ts-host-reuse
+++ b/ts-host-reuse
@@ -135,6 +135,14 @@ sub noop_if_playing () {
     }
 }
 
+sub ensure_known_hosts ($) {
+    my ($ho) = @_;
+    # Don't need to bother if job uses only one host
+    return if scalar(grep { m/(_|^)host$/ } keys %r) == 1;
+    target_putfilecontents_root_stash($ho, 30, known_hosts(),
+                                     '/root/.ssh/known_hosts');
+}
+
 #---------- actions ----------
 
 sub act_prealloc () {
@@ -153,6 +161,7 @@ sub act_start_test () {
     return unless $ho->{Shared};
     my %oldstate = map { $_ => 1 } qw(prep ready);
     host_shared_mark_ready($ho, $sharetype, \%oldstate, 'mid-test');
+    ensure_known_hosts($ho);
 }
 
 sub act_final () {
-- 
2.20.1




 


Rackspace

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