Commit cc76869f authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Merge branch 'compress'

parents b872d8d0 b818c48b
......@@ -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