Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emulab
emulab-devel
Commits
bfa1fd7d
Commit
bfa1fd7d
authored
Aug 04, 2010
by
Leigh B Stoller
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git-public.flux.utah.edu:/flux/git/emulab-devel
parents
83477fc9
8b18971e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
4 deletions
+46
-4
protogeni/xmlrpc/geni-am.pm.in
protogeni/xmlrpc/geni-am.pm.in
+34
-1
protogeni/xmlrpc/protogeni-wrapper.pl.in
protogeni/xmlrpc/protogeni-wrapper.pl.in
+12
-3
No files found.
protogeni/xmlrpc/geni-am.pm.in
View file @
bfa1fd7d
...
...
@@ -6,9 +6,12 @@
#
use
strict
;
use
English
;
use
Frontier::
Responder
;
use
Frontier::
RPC2
;
# Do this early so that we talk to the right DB.
use
vars
qw($GENI_DBNAME $GENI_METHODS $EMULAB_PEMFILE)
;
use
vars
qw($GENI_DBNAME $GENI_METHODS $EMULAB_PEMFILE
$GENI_RESPONSE_CONVERTER)
;
BEGIN
{
$GENI_DBNAME
=
"
geni
";
}
# Configure variables
...
...
@@ -18,6 +21,7 @@ $EMULAB_PEMFILE = "$ETCDIR/genisa.pem";
# Testbed libraries.
use
lib
'
@prefix@/lib
';
use
GeniAM
;
use
GeniResponse
;
if
(
!
defined
(
$GENI_VERSION
)
||
$GENI_VERSION
eq
"
1.0
")
{
$GENI_METHODS
=
{
...
...
@@ -31,5 +35,34 @@ if (!defined($GENI_VERSION) || $GENI_VERSION eq "1.0") {
};
}
#----------------------------------------------------------------------
# Morph the ProtoGENI response (a hash with three keys; a
# GeniResponse) into a GENI AM response (a single value or a fault if
# there is an error).
#
# $response is an XML RPC response, which is a three element hash. The
# value element is the GeniResponse hash.
#----------------------------------------------------------------------
sub
ConvertResponse
($)
{
my
(
$geni_response
)
=
@_
;
my
$decoder
=
Frontier::
RPC2
->
new
();
my
$response
;
if
(
GeniResponse::
IsError
(
$geni_response
))
{
# An error result gets mapped to an XML RPC fault
$response
=
$decoder
->
encode_fault
(
GeniResponse::
code
(
$geni_response
),
GeniResponse::
output
(
$geni_response
));
}
else
{
# A successful result means return the value
$response
=
$decoder
->
encode_response
(
GeniResponse::
value
(
$geni_response
));
}
return
$response
;
}
$GENI_RESPONSE_CONVERTER
=
\
&ConvertResponse
;
1
;
protogeni/xmlrpc/protogeni-wrapper.pl.in
View file @
bfa1fd7d
...
...
@@ -42,7 +42,8 @@ my %GENI_MODULES = ( "cm" => "@prefix@/lib/protogeni-cm.pm",
"
ses
"
=>
"
@prefix
@/lib/protogeni-ses.pm
"
);
# These variables are shared with the loaded module.
use
vars
qw($EMULAB_PEMFILE $GENI_METHODS $GENI_VERSION)
;
use
vars
qw($EMULAB_PEMFILE $GENI_METHODS $GENI_VERSION
$GENI_RESPONSE_CONVERTER)
;
# Testbed libraries.
use
lib
'
@prefix@/lib
';
...
...
@@ -293,8 +294,6 @@ if ($@) {
"
Error executing RPC:
\n
"
.
$@
.
"
\n\n
"
.
$request
);
}
else
{
$response
=
$decoder
->
encode_response
(
$result
);
if
(
GeniResponse::
IsError
(
$result
))
{
$message
.=
"
Error:
"
.
$result
->
{'
code
'}
.
"
\n
";
}
...
...
@@ -308,6 +307,16 @@ else {
$message
.=
"
Request:
\n
"
.
$request
.
"
\n
";
AddAuditInfo
("
message
",
$message
);
#
# Added this for geni-am ...
#
if
(
defined
(
$GENI_RESPONSE_CONVERTER
))
{
$response
=
&$GENI_RESPONSE_CONVERTER
(
$result
);
}
else
{
$response
=
$decoder
->
encode_response
(
$result
);
}
}
if
(
$debug
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment