Improve Python 3.x compatibility

A bit of mechanical translation to clean
out the deprecated except x,y: construct

Change-Id: I80883b6b0c014bdf4799e8b7b2c4a4a07d951a0b
This commit is contained in:
Dirk Mueller 2013-04-22 04:16:31 +02:00
parent 0490eab24c
commit 98c4e04ac6
3 changed files with 5 additions and 5 deletions

View File

@ -397,7 +397,7 @@ def bm_interface_set_vif_uuid(context, if_id, vif_uuid):
try:
session.add(bm_interface)
session.flush()
except db_exc.DBError, e:
except db_exc.DBError as e:
# TODO(deva): clean up when db layer raises DuplicateKeyError
if str(e).find('IntegrityError') != -1:
raise exception.NovaException(_("Baremetal interface %s "

View File

@ -307,7 +307,7 @@ class BareMetalDriver(driver.ComputeDriver):
self._unplug_vifs(instance, network_info)
_update_state(context, node, None, baremetal_states.DELETED)
except Exception, e:
except Exception as e:
with excutils.save_and_reraise_exception():
try:
LOG.error(_("Error from baremetal driver "

View File

@ -45,7 +45,7 @@ def inject_into_image(image, key, net, metadata, admin_password,
def unlink_without_raise(path):
try:
os.unlink(path)
except OSError, e:
except OSError as e:
if e.errno == errno.ENOENT:
return
else:
@ -56,7 +56,7 @@ def rmtree_without_raise(path):
try:
if os.path.isdir(path):
shutil.rmtree(path)
except OSError, e:
except OSError as e:
LOG.warn(_("Failed to remove dir %(path)s, error: %(e)s") % locals())
@ -68,7 +68,7 @@ def write_to_file(path, contents):
def create_link_without_raise(source, link):
try:
os.symlink(source, link)
except OSError, e:
except OSError as e:
if e.errno == errno.EEXIST:
return
else: