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

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



From: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>

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@xxxxxxxxxxxxx>
---
 Osstest/Debian.pm      | 10 ++++++----
 Osstest/TestSupport.pm |  6 ++++++
 2 files changed, 12 insertions(+), 4 deletions(-)

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 "*";
-- 
2.20.1




 


Rackspace

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