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

[Xen-devel] [OSSTEST PATCH] TestSupport: stash installer files etc.



Stash the pxeboot config file, the preseed file, et al.  This is done
centrally in file_link_contents.

We don't stash things whose $contents is actually a coderef because
(a) doing so would be inconvenient and (b) many of them are large and
not very interesting.

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 Osstest/TestSupport.pm |   22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 6558fc8..d5875b3 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -1833,17 +1833,18 @@ sub await_webspace_fetch_byleaf ($$$$$) {
 
 sub create_webfile ($$$) {
     my ($ho, $tail, $contents) = @_; # $contents as for file_link_contents
-    my $wf_common= $c{WebspaceCommon}.$ho->{Name}."_".$tail;
+    my $wf_rhs= $ho->{Name}."_".$tail;
+    my $wf_common= $c{WebspaceCommon}.$wf_rhs;
     my $wf_url= $c{WebspaceUrl}.$wf_common;
     my $wf_file= $c{WebspaceFile}.$wf_common;
-    file_link_contents($wf_file, $contents);
+    file_link_contents($wf_file, $contents, "webspace-$wf_rhs");
     return $wf_url;
 }
 
 #---------- pxe handling ----------
 
-sub file_link_contents ($$) {
-    my ($fn, $contents) = @_;
+sub file_link_contents ($$$) {
+    my ($fn, $contents, $stash) = @_;
     # $contents as for file_write_contents
     my ($dir, $base, $ext) =
         $fn =~ m,^( (?: .*/ )? )( [^/]+? )( (?: \.[^./]+ )? )$,x
@@ -1851,6 +1852,14 @@ sub file_link_contents ($$) {
     my $real= "$dir$base--osstest$ext";
     my $linktarg= "$base--osstest$ext";
 
+    if (ref $contents) { $stash = undef; }
+
+    if (defined $stash) {
+       my $stashh= open_unique_stashfile(\$stash);
+       print $stashh $contents or die "$stash: $!";
+       close $stashh or die "$stash: $!";
+    }
+
     file_simple_write_contents($real, $contents);
 
     my $newlink= "$dir$base--newlink$ext";
@@ -1863,7 +1872,7 @@ sub file_link_contents ($$) {
     }
     symlink $linktarg, $newlink or die "$newlink $!";
     rename $newlink, $fn or die "$newlink $fn $!";
-    logm("wrote $fn");
+    logm("wrote $fn". (defined $stash ? " (stashed as $stash)" : ""));
 }
 
 sub host_pxefile ($) {
@@ -1901,7 +1910,8 @@ sub host_pxefile ($) {
 sub setup_pxeboot ($$) {
     my ($ho, $bootfile) = @_;
     my $f= host_pxefile($ho);
-    file_link_contents("$ho->{Tftp}{Path}$ho->{Tftp}{PxeDir}$f", $bootfile);
+    file_link_contents("$ho->{Tftp}{Path}$ho->{Tftp}{PxeDir}$f", $bootfile,
+       "$ho->{Name}-pxelinux.cfg");
 }
 
 sub setup_pxeboot_local ($) {
-- 
1.7.10.4


_______________________________________________
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®.