Skip to content

Commit

Permalink
Don't try to use a name bound via 'as' outside the try/except block.
Browse files Browse the repository at this point in the history
  • Loading branch information
dwlehman committed Jan 28, 2016
1 parent 31d6bd5 commit 4bf42c4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions blivet/devicefactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,18 +642,19 @@ def _create_device(self):
raise

self.storage.create_device(device)
e = None
err = None
try:
self._post_create()
except (StorageError, blockdev.BlockDevError) as e:
log.error("device post-create method failed: %s", e)
err = str(e)
else:
if not device.size:
e = StorageError("failed to create device")
err = "failed to create device"

if e:
if err:
self.storage.destroy_device(device)
raise StorageError(e)
raise StorageError(err)

ret = device
if self.encrypted:
Expand Down

0 comments on commit 4bf42c4

Please sign in to comment.