mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 14:40:19 -07:00
reword "except Error as e:" into "except Error, e:" to be compatible with Python 2.5 (#5852)
This commit is contained in:
parent
2d0e9cd75d
commit
658c15930e
27 changed files with 118 additions and 118 deletions
|
@ -100,7 +100,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 as e:
|
||||
except Exception, e:
|
||||
module.fail_json(msg = "Error authenticating to the keystone: %s " % e.message)
|
||||
global _os_keystone
|
||||
_os_keystone = kclient
|
||||
|
@ -110,7 +110,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 as e:
|
||||
except Exception, e:
|
||||
module.fail_json(msg = "Error getting network endpoint: %s" % e.message)
|
||||
return endpoint
|
||||
|
||||
|
@ -124,7 +124,7 @@ def _get_neutron_client(module, kwargs):
|
|||
}
|
||||
try:
|
||||
neutron = client.Client('2.0', **kwargs)
|
||||
except Exception as e:
|
||||
except Exception, e:
|
||||
module.fail_json(msg = "Error in connecting to neutron: %s " % e.message)
|
||||
return neutron
|
||||
|
||||
|
@ -149,7 +149,7 @@ def _get_router_id(module, neutron):
|
|||
}
|
||||
try:
|
||||
routers = neutron.list_routers(**kwargs)
|
||||
except Exception as e:
|
||||
except Exception, 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 _get_subnet_id(module, neutron):
|
|||
}
|
||||
try:
|
||||
subnets = neutron.list_subnets(**kwargs)
|
||||
except Exception as e:
|
||||
except Exception, e:
|
||||
module.fail_json( msg = " Error in getting the subnet list:%s " % e.message)
|
||||
if not subnets['subnets']:
|
||||
return None
|
||||
|
@ -177,7 +177,7 @@ def _get_port_id(neutron, module, router_id, subnet_id):
|
|||
}
|
||||
try:
|
||||
ports = neutron.list_ports(**kwargs)
|
||||
except Exception as e:
|
||||
except Exception, e:
|
||||
module.fail_json( msg = "Error in listing ports: %s" % e.message)
|
||||
if not ports['ports']:
|
||||
return None
|
||||
|
@ -193,7 +193,7 @@ def _add_interface_router(neutron, module, router_id, subnet_id):
|
|||
}
|
||||
try:
|
||||
neutron.add_interface_router(router_id, kwargs)
|
||||
except Exception as e:
|
||||
except Exception, e:
|
||||
module.fail_json(msg = "Error in adding interface to router: %s" % e.message)
|
||||
return True
|
||||
|
||||
|
@ -203,7 +203,7 @@ def _remove_interface_router(neutron, module, router_id, subnet_id):
|
|||
}
|
||||
try:
|
||||
neutron.remove_interface_router(router_id, kwargs)
|
||||
except Exception as e:
|
||||
except Exception, 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