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

[Xen-devel] [OSSTEST PATCH 5/6] ts-logs-capture: try_fetch_logs: Honour $fs_ and $out_prefix



This allows us to add some stuff to add to each pattern, and each
filename.  This will be useful in a moment.

None of the call sites pass this yet.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 ts-logs-capture | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/ts-logs-capture b/ts-logs-capture
index 418155ce..6be77676 100755
--- a/ts-logs-capture
+++ b/ts-logs-capture
@@ -68,11 +68,13 @@ END
     @guests = grep { defined $_->{Domid} } @allguests;
 }
 
-sub try_fetch_logs ($$) {
-    my ($lho, $logfilepats) = @_;
+sub try_fetch_logs ($$;$$) {
+    my ($lho, $logfilepats, $fs_prefix,$out_prefix) = @_;
+    $fs_prefix //= '';
+    $out_prefix //= '';
     my $ok= 0;
     foreach my $logfilepat (@$logfilepats) {
-        my $logfileslist= $logfilepat;
+        my $logfileslist= $fs_prefix.$logfilepat;
         if ($logfileslist =~ m/[*?]/) {
             if (!eval {
                 $logfileslist=
@@ -91,8 +93,9 @@ END
         }
         foreach my $logfile (split / /, $logfileslist) {
             my $llogfile= $logfile;
+           $llogfile =~ s,^\Q$fs_prefix\E,,;
             $llogfile =~ s,/,-,g;
-            $llogfile= hostnamepath($lho)."--$llogfile";
+            $llogfile= hostnamepath($lho)."-$out_prefix-$llogfile";
             logm("fetching $logfile to $llogfile");
             if (!eval {
                 target_getfile_root($lho,60, $logfile,"$stash/$llogfile");
-- 
2.11.0




 


Rackspace

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