Commit 4f0f53d4 authored by Leigh Stoller's avatar Leigh Stoller

Some improvements to the logging to make it easier to find the error,

and to cut down on the number of messages sent.
parent a91824f1
......@@ -20,9 +20,10 @@ use vars qw(@ISA @EXPORT);
GENIRESPONSE_TIMEDOUT GENIRESPONSE_DBERROR
GENIRESPONSE_RPCERROR GENIRESPONSE_UNAVAILABLE
GENIRESPONSE_SEARCHFAILED GENIRESPONSE_UNSUPPORTED
GENIRESPONSE_BUSY GENIRESPONSE_EXPIRED);
GENIRESPONSE_BUSY GENIRESPONSE_EXPIRED GENIRESPONSE);
use overload ('""' => 'Stringify');
my $current_response = undef;
#
# GENI XMLRPC defs. Also see ../lib/Protogeni.pm.in if you change this.
......@@ -43,6 +44,7 @@ sub GENIRESPONSE_SEARCHFAILED() {12; }
sub GENIRESPONSE_UNSUPPORTED() {13; }
sub GENIRESPONSE_BUSY() {14; }
sub GENIRESPONSE_EXPIRED() {15; }
sub GENIRESPONSE() { return $current_response; }
#
# This is the (python-style) "structure" we want to return.
......@@ -82,6 +84,8 @@ sub Create($$;$$)
my $self = {"code" => $code,
"value" => $value,
"output" => $output};
$current_response = $self;
return $self;
}
......
......@@ -26,6 +26,7 @@ my $EMULAB_PEMFILE = "@prefix@/etc/genich.pem";
use lib '@prefix@/lib';
use GeniCH;
use GeniCertificate;
use GeniResponse;
use libaudit;
# Geniuser.
......@@ -123,12 +124,13 @@ my $responder = Frontier::Responder->new( "methods" => {
my $response = $responder->{'_decode'}->serve($request,
$responder->{'methods'});
# Add stuff for log message if sent.
AddAuditInfo("message", $response . "\n\n" . $request);
#
# Terminate the log capture so that we can print the response to STDOUT
# for the web server.
#
#print STDERR "\n\n" . $response;
LogEnd(0);
LogEnd();
print "Content-Type: text/xml\n\n" . $response;
......
......@@ -134,11 +134,12 @@ my $responder = Frontier::Responder->new( "methods" => {
my $response = $responder->{'_decode'}->serve($request,
$responder->{'methods'});
# Add stuff for log message if sent.
AddAuditInfo("message", $response . "\n\n" . $request);
#
# Terminate the log capture so that we can print the response to STDOUT
# for the web server.
#
print STDERR "\n\n" . $response;
LogEnd(0);
print "Content-Type: text/xml \n\n" . $response;
......
......@@ -26,6 +26,7 @@ my $EMULAB_PEMFILE = "@prefix@/etc/genisa.pem";
use lib '@prefix@/lib';
use GeniSA;
use Genixmlrpc;
use GeniResponse;
use libaudit;
# Geniuser.
......@@ -111,9 +112,6 @@ LogStart(0, undef, LIBAUDIT_LOGTBOPS());
#
Genixmlrpc->SetContext(Genixmlrpc->Context($certificate));
# Add stuff for log message if sent.
AddAuditInfo("message", $request . "\n");
my $responder = Frontier::Responder->new( "methods" => {
"GetCredential" => \&GeniSA::GetCredential,
"Resolve" => \&GeniSA::Resolve,
......@@ -129,13 +127,12 @@ my $responder = Frontier::Responder->new( "methods" => {
my $response = $responder->{'_decode'}->serve($request,
$responder->{'methods'});
# Add stuff for log message if sent.
AddAuditInfo("message", $response . "\n\n" . $request);
#
# Terminate the log capture so that we can print the response to STDOUT
# for the web server.
#
#print STDERR "\n\n" . $response;
#print STDERR time() . "\n";
LogEnd();
print "Content-Type: text/xml \n\n" . $response;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment