mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
reword "except Error as e:" into "except Error, e:" to be compatible with Python 2.5 (#5852)
This commit is contained in:
committed by
James Cammarata
parent
2d0e9cd75d
commit
658c15930e
@@ -128,7 +128,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
|
||||
@@ -138,7 +138,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
|
||||
|
||||
@@ -152,7 +152,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
|
||||
|
||||
@@ -177,7 +177,7 @@ def _get_net_id(neutron, module):
|
||||
}
|
||||
try:
|
||||
networks = neutron.list_networks(**kwargs)
|
||||
except Exception as e:
|
||||
except Exception, e:
|
||||
module.fail_json("Error in listing neutron networks: %s" % e.message)
|
||||
if not networks['networks']:
|
||||
return None
|
||||
@@ -197,7 +197,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
|
||||
@@ -239,7 +239,7 @@ def _create_subnet(module, neutron):
|
||||
def _delete_subnet(module, neutron, subnet_id):
|
||||
try:
|
||||
neutron.delete_subnet(subnet_id)
|
||||
except Exception as e:
|
||||
except Exception, e:
|
||||
module.fail_json( msg = "Error in deleting subnet: %s" % e.message)
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user