mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
Fixing open stack compile time errors irt exception handling for Python 3 (#3848)
This commit is contained in:
@@ -101,7 +101,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
|
||||
@@ -111,7 +111,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
|
||||
|
||||
@@ -125,7 +125,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
|
||||
@@ -164,7 +164,7 @@ def _create_router(module, neutron):
|
||||
}
|
||||
try:
|
||||
new_router = neutron.create_router(dict(router=router))
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
module.fail_json( msg = "Error in creating router: %s" % e.message)
|
||||
return new_router['router']['id']
|
||||
|
||||
|
||||
Reference in New Issue
Block a user