From: Eric Bollengier Date: Mon, 13 Dec 2010 20:21:38 +0000 (+0100) Subject: regress: Add get_traces and truncate_traces to regress-win32.pl X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8bc8e1a8b47cd3b97bdca3e1c7b9e6f2de5e5d67;p=bacula%2Fbacula regress: Add get_traces and truncate_traces to regress-win32.pl --- diff --git a/regress/scripts/regress-win32.pl b/regress/scripts/regress-win32.pl index c931bcd765..6efdb3d651 100644 --- a/regress/scripts/regress-win32.pl +++ b/regress/scripts/regress-win32.pl @@ -921,6 +921,22 @@ sub remove_dir return "OK\n"; } +sub get_traces +{ + my ($file) = <"c:/program files/bacula/working/*.trace">; + if (!$file || ! -f $file) { + return "ERR\n$!\n"; + } + return $file; +} + +sub truncate_traces +{ + my $f = get_traces(); + unlink($f) or return "ERR\n$!\n"; + return "OK\n"; +} + # When adding an action, fill this hash with the right function my %action_list = ( nop => sub { return "OK\n"; }, @@ -945,6 +961,8 @@ my %action_list = ( create_schedtask => \&create_schedtask, del_schedtask => \&del_schedtask, check_schedtask => \&check_schedtask, + get_traces => \&get_traces, + truncate_traces => \&truncate_traces, check_mssql => \&check_mssql, setup_mssql_db => \&setup_mssql_db, @@ -984,11 +1002,17 @@ sub handle_client print "Exec $action:\n"; my $ret = $action_list{$action}($r); - my $h = HTTP::Headers->new('Content-Type' => 'text/plain') ; - my $r = HTTP::Response->new(HTTP::Status::RC_OK, - 'OK', $h, $ret) ; - print $ret; - $c->send_response($r) ; + if ($action eq 'get_traces' && $ret !~ /ERR/) { + print "Sending $ret\n"; + $c->send_file_response($ret); + + } else { + my $h = HTTP::Headers->new('Content-Type' => 'text/plain') ; + my $r = HTTP::Response->new(HTTP::Status::RC_OK, + 'OK', $h, $ret) ; + print $ret; + $c->send_response($r) ; + } } else { print "$action not found, probably a version problem\n"; $c->send_error(RC_NOT_FOUND) ;