Fixing open stack compile time errors irt exception handling for Python 3 (#3848)

This commit is contained in:
@ 2016-06-03 06:37:09 -07:00 committed by Matt Clay
commit 7960e99310
11 changed files with 73 additions and 73 deletions

View file

@ -135,7 +135,7 @@ def _get_ksclient(module, kwargs):
password=kwargs.get('login_password'),
tenant_name=kwargs.get('login_tenant_name'),
auth_url=kwargs.get('auth_url'))
except Exception, e:
except Exception as e:
module.fail_json(msg = "Error authenticating to the keystone: %s" %e.message)
global _os_keystone
_os_keystone = kclient
@ -145,7 +145,7 @@ def _get_ksclient(module, kwargs):
def _get_endpoint(module, ksclient):
try:
endpoint = ksclient.service_catalog.url_for(service_type='network', endpoint_type='publicURL')
except Exception, e:
except Exception as e:
module.fail_json(msg = "Error getting network endpoint: %s" % e.message)
return endpoint
@ -159,7 +159,7 @@ def _get_neutron_client(module, kwargs):
}
try:
neutron = client.Client('2.0', **kwargs)
except Exception, e:
except Exception as e:
module.fail_json(msg = " Error in connecting to neutron: %s" % e.message)
return neutron
@ -184,7 +184,7 @@ def _get_net_id(neutron, module):
}
try:
networks = neutron.list_networks(**kwargs)
except Exception, e:
except Exception as e:
module.fail_json("Error in listing neutron networks: %s" % e.message)
if not networks['networks']:
return None
@ -204,7 +204,7 @@ def _get_subnet_id(module, neutron):
}
try:
subnets = neutron.list_subnets(**kwargs)
except Exception, e:
except Exception as e:
module.fail_json( msg = " Error in getting the subnet list:%s " % e.message)
if not subnets['subnets']:
return None
@ -238,7 +238,7 @@ def _create_subnet(module, neutron):
subnet.pop('dns_nameservers')
try:
new_subnet = neutron.create_subnet(dict(subnet=subnet))
except Exception, e:
except Exception as e:
module.fail_json(msg = "Failure in creating subnet: %s" % e.message)
return new_subnet['subnet']['id']
@ -246,7 +246,7 @@ def _create_subnet(module, neutron):
def _delete_subnet(module, neutron, subnet_id):
try:
neutron.delete_subnet(subnet_id)
except Exception, e:
except Exception as e:
module.fail_json( msg = "Error in deleting subnet: %s" % e.message)
return True