On 24-09-2014 23:08, Aline Manera wrote:
+ # Verify if the URL is valid
+ if create_param == 'url':
+ url = params['url']
+ try:
+ urllib2.urlopen(url)
We should validate the specific parameters for the 'url' case inside the
function '_create_volume_with_url', just like we check if the upload
file exists before reading it inside the function
'_create_volume_with_file'.
Actually, I think the best way to fix this problem is by enlarging the
try/except block to include the existing urllib2.urlopen call. We don't
need to make two requests. That call will raise the same exception
there. The problem now is that it's not included inside the try/except
block, hence the "Unexpected exception".
But if we do keep this approach, you still need to close the return
variable of "urllib2.urlopen".