mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-05 07:54:00 -07:00
Fixing open stack compile time errors irt exception handling for Python 3 (#3848)
This commit is contained in:
parent
13bebda244
commit
7960e99310
11 changed files with 73 additions and 73 deletions
|
@ -102,7 +102,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
|
||||
|
@ -112,7 +112,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
|
||||
|
||||
|
@ -126,7 +126,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
|
||||
|
||||
|
@ -150,7 +150,7 @@ def _get_router_id(module, neutron):
|
|||
}
|
||||
try:
|
||||
routers = neutron.list_routers(**kwargs)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
module.fail_json(msg = "Error in getting the router list: %s " % e.message)
|
||||
if not routers['routers']:
|
||||
return None
|
||||
|
@ -165,7 +165,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
|
||||
|
@ -178,7 +178,7 @@ def _get_port_id(neutron, module, router_id, subnet_id):
|
|||
}
|
||||
try:
|
||||
ports = neutron.list_ports(**kwargs)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
module.fail_json( msg = "Error in listing ports: %s" % e.message)
|
||||
if not ports['ports']:
|
||||
return None
|
||||
|
@ -194,7 +194,7 @@ def _add_interface_router(neutron, module, router_id, subnet_id):
|
|||
}
|
||||
try:
|
||||
neutron.add_interface_router(router_id, kwargs)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
module.fail_json(msg = "Error in adding interface to router: %s" % e.message)
|
||||
return True
|
||||
|
||||
|
@ -204,7 +204,7 @@ def _remove_interface_router(neutron, module, router_id, subnet_id):
|
|||
}
|
||||
try:
|
||||
neutron.remove_interface_router(router_id, kwargs)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
module.fail_json(msg="Error in removing interface from router: %s" % e.message)
|
||||
return True
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue