From 3455a76237481c3bbb590e88d37b6ca351c113fc Mon Sep 17 00:00:00 2001 From: Prasanna Santhanam Date: Sat, 10 Aug 2013 16:18:29 +0530 Subject: [PATCH] Add more debug logging to download detached volume test Signed-off-by: Prasanna Santhanam --- test/integration/smoke/test_volumes.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/integration/smoke/test_volumes.py b/test/integration/smoke/test_volumes.py index dd3d8a41b0b..b60b70e86ed 100644 --- a/test/integration/smoke/test_volumes.py +++ b/test/integration/smoke/test_volumes.py @@ -521,13 +521,15 @@ class TestVolumes(cloudstackTestCase): #Attempt to download the volume and save contents locally try: formatted_url = urllib.unquote_plus(extract_vol.url) + self.debug("Attempting to download volume at url %s" % formatted_url) response = urllib.urlopen(formatted_url) + self.debug("response from volume url %s" % response.getcode()) fd, path = tempfile.mkstemp() + self.debug("Saving volume %s to path %s" %(self.volume.id, path)) os.close(fd) - fd = open(path, 'wb') - fd.write(response.read()) - fd.close() - + with open(path, 'wb') as fd: + fd.write(response.read()) + self.debug("Saved volume successfully") except Exception: self.fail( "Extract Volume Failed with invalid URL %s (vol id: %s)" \