Commit b818c48b authored by Tom Mitchell's avatar Tom Mitchell
Browse files

Fix GENI AM ListResources return value.

ListResources always return a string. If compression is requested the
string's contents are a base64 encoded compressed RSpec. ListResources
now takes the XML-RPC base64 result from DiscoverResources and
converts it to a string value and returns that.
parent d312054b
......@@ -61,7 +61,19 @@ sub ListResources()
'available' => $available,
'compress' => $compress
};
return GeniCMV2::DiscoverResources($discover_args);
my $response = GeniCMV2::DiscoverResources($discover_args);
if (GeniResponse::IsError($response)) {
return $response;
} else {
# DiscoverResources returns a base64 object, but ListResources
# needs to return a String representation of that base64
# object. The logic is that ListResources should *always*
# return a String instead of returning different types based
# on the args.
my $base64 = GeniResponse::value($response);
my $response_value = $base64->value();
return GeniResponse->Create( GENIRESPONSE_SUCCESS, $response_value );
}
}
# Create a sliver by allocating and starting resources.
......
......@@ -21,6 +21,7 @@ import pwd
import getopt
import os
import re
import zlib
execfile( "test-common.py" )
......@@ -44,9 +45,11 @@ try:
response = do_method("am", "ListResources", params,
response_handler=geni_am_response_handler)
if compress_key in options and options[compress_key]:
# decompress the result
import zlib
print zlib.decompress(response.data)
# decode and decompress the result
#
# response is a string whose content is a base64 encoded
# representation of a zlib compressed rspec
print zlib.decompress(response.decode('base64'))
else:
print response
except xmlrpclib.Fault, e:
......
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