diff mbox series

[OSSTEST,62/82] runvar access: Introduce effects_gone_before_share_reuse

Message ID 20201007180024.7932-63-iwj@xenproject.org (mailing list archive)
State New, archived
Headers show
Series Reuse test hosts | expand

Commit Message

Ian Jackson Oct. 7, 2020, 6 p.m. UTC
From: Ian Jackson <ian.jackson@eu.citrix.com>

The syslog server, and its port, is used for things that happen in
this job, but the syslog server is torn down and a new one started,
when the host is reused.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 Osstest/Debian.pm      | 10 ++++++----
 Osstest/TestSupport.pm |  6 ++++++
 2 files changed, 12 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm
index ae3c1d33..01930e1f 100644
--- a/Osstest/Debian.pm
+++ b/Osstest/Debian.pm
@@ -727,10 +727,12 @@  sub di_installcmdline_core ($$;@) {
     push @cl, "priority=$debconf_priority";
     push @cl, "rescue/enable=true" if $xopts{RescueMode};
 
-    if ($r{syslog_server}) {
-	$r{syslog_server} =~ m/:(\d+)$/ or die "$r{syslog_server} ?";
-	push @cl, "log_host=$`", "log_port=$1";
-    }
+    effects_gone_before_share_reuse(sub {
+        if ($r{syslog_server}) {
+	    $r{syslog_server} =~ m/:(\d+)$/ or die "$r{syslog_server} ?";
+	    push @cl, "log_host=$`", "log_port=$1";
+	}
+    });
 
     return @cl;
 }
diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index c6bd6714..752c36c5 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -144,6 +144,7 @@  BEGIN {
                       gitcache_setup
 
 		      @accessible_runvar_pats sharing_for_build
+		      effects_gone_before_share_reuse
                       );
     %EXPORT_TAGS = ( );
 
@@ -3173,6 +3174,11 @@  END
 
 sub sharing_for_build () { @accessible_runvar_pats = qw(*); };
 
+sub effects_gone_before_share_reuse ($) {
+    local @accessible_runvar_pats = qw(*);
+    $_[0]();
+}
+
 sub runvar_access_restrict () {
     # restricts runvars to those in @accessible_runvar_pats
     return if "@accessible_runvar_pats" eq "*";