From 6f36385cb87d04577d60032f6e74c732edab6d45 Mon Sep 17 00:00:00 2001 From: qinchunhua Date: Thu, 7 Jul 2016 07:42:01 -0400 Subject: Correct reraising of exception When an exception was caught and rethrown, it should call 'raise' without any arguments because it shows the place where an exception occured initially instead of place where the exception re-raised. Change-Id: I5fb6dea5da7fb6e1e2b339a713c7d37f8c99e407 --- openstackclient/image/v2/image.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) mode change 100644 => 100755 openstackclient/image/v2/image.py (limited to 'openstackclient/image') diff --git a/openstackclient/image/v2/image.py b/openstackclient/image/v2/image.py old mode 100644 new mode 100755 index 309b1b6b..64092fea --- a/openstackclient/image/v2/image.py +++ b/openstackclient/image/v2/image.py @@ -339,7 +339,7 @@ class CreateImage(command.ShowOne): with fp: try: image_client.images.upload(image.id, fp) - except Exception as e: + except Exception: # If the upload fails for some reason attempt to remove the # dangling queued image made by the create() call above but # only if the user did not specify an id which indicates @@ -349,7 +349,7 @@ class CreateImage(command.ShowOne): image_client.images.delete(image.id) except Exception: pass # we don't care about this one - raise e # now, throw the upload exception again + raise # now, throw the upload exception again # update the image after the data has been uploaded image = image_client.images.get(image.id) @@ -834,11 +834,11 @@ class SetImage(command.Command): try: image = image_client.images.update(image.id, **kwargs) - except Exception as e: + except Exception: if activation_status is not None: LOG.info(_("Image %(id)s was %(status)s."), {'id': image.id, 'status': activation_status}) - raise e + raise class ShowImage(command.ShowOne): -- cgit v1.2.1