Sync requirements with openstack/requirements
This switches us from the ipaddr lib, to the netaddr lib which is in use by other openstack projects. This also means an updated: - keystoneclient - hacking - distribute - setuptools Finally, we're violating two new Hacking rules (H231 / H501), so we cleanup these violations. Change-Id: I6658a0209fc7f0942188f7c518171e6b1fa2b4aa
This commit is contained in:
parent
b59a696aca
commit
eb16b1e1be
@ -133,7 +133,7 @@ class FaultWrapperMiddleware(wsgi.Middleware):
|
||||
def __call__(self, request):
|
||||
try:
|
||||
return request.get_response(self.application)
|
||||
except exceptions.Base, e:
|
||||
except exceptions.Base as e:
|
||||
# Handle Designate Exceptions
|
||||
status = e.error_code if hasattr(e, 'error_code') else 500
|
||||
|
||||
@ -152,7 +152,7 @@ class FaultWrapperMiddleware(wsgi.Middleware):
|
||||
response['errors'] = e.errors
|
||||
|
||||
return self._handle_exception(request, e, status, response)
|
||||
except rpc_common.Timeout, e:
|
||||
except rpc_common.Timeout as e:
|
||||
# Special case for RPC timeout's
|
||||
response = {
|
||||
'code': 504,
|
||||
@ -160,7 +160,7 @@ class FaultWrapperMiddleware(wsgi.Middleware):
|
||||
}
|
||||
|
||||
return self._handle_exception(request, e, 504, response)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
# Handle all other exception types
|
||||
return self._handle_exception(request, e)
|
||||
|
||||
|
@ -81,7 +81,7 @@ class Backend(Plugin):
|
||||
# First up, delete the domain from the backend.
|
||||
try:
|
||||
self.delete_domain(context, domain)
|
||||
except exceptions.DomainNotFound, e:
|
||||
except exceptions.DomainNotFound as e:
|
||||
# NOTE(Kiall): This means a domain was missing from the backend.
|
||||
# Good thing we're doing a sync!
|
||||
LOG.warn("Failed to delete domain '%s' during sync. Message: %s",
|
||||
@ -104,7 +104,7 @@ class Backend(Plugin):
|
||||
# First up, delete the record from the backend.
|
||||
try:
|
||||
self.delete_record(context, domain, record)
|
||||
except exceptions.RecordNotFound, e:
|
||||
except exceptions.RecordNotFound as e:
|
||||
# NOTE(Kiall): This means a record was missing from the backend.
|
||||
# Good thing we're doing a sync!
|
||||
LOG.warn("Failed to delete record '%s' in domain '%s' during sync."
|
||||
|
@ -36,9 +36,9 @@ def wrap_backend_call():
|
||||
"""
|
||||
try:
|
||||
yield
|
||||
except exceptions.Backend, exc:
|
||||
except exceptions.Backend as exc:
|
||||
raise
|
||||
except Exception, exc:
|
||||
except Exception as exc:
|
||||
raise exceptions.Backend('Unknown backend failure: %r' % exc)
|
||||
|
||||
|
||||
@ -808,12 +808,12 @@ class Service(rpc_service.Service):
|
||||
|
||||
try:
|
||||
backend_status = self.backend.ping(context)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
backend_status = {'status': False, 'message': str(e)}
|
||||
|
||||
try:
|
||||
storage_status = self.storage_api.ping(context)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
storage_status = {'status': False, 'message': str(e)}
|
||||
|
||||
if backend_status and storage_status:
|
||||
|
@ -15,7 +15,7 @@
|
||||
# under the License.
|
||||
import re
|
||||
import jsonschema
|
||||
import ipaddr
|
||||
import netaddr
|
||||
import iso8601
|
||||
from datetime import datetime
|
||||
from designate.openstack.common import log as logging
|
||||
@ -101,8 +101,8 @@ class SchemaValidator(jsonschema.Draft3Validator):
|
||||
# IPv4 Address
|
||||
if self.is_type(instance, "string"):
|
||||
try:
|
||||
ipaddr.IPv4Address(instance)
|
||||
except ipaddr.AddressValueError:
|
||||
netaddr.IPAddress(instance, version=4)
|
||||
except netaddr.AddrFormatError:
|
||||
msg = "%s is not an IPv4 address" % (instance)
|
||||
yield jsonschema.ValidationError(msg)
|
||||
else:
|
||||
@ -113,8 +113,8 @@ class SchemaValidator(jsonschema.Draft3Validator):
|
||||
# IPv6 Address
|
||||
if self.is_type(instance, "string"):
|
||||
try:
|
||||
ipaddr.IPv6Address(instance)
|
||||
except ipaddr.AddressValueError:
|
||||
netaddr.IPAddress(instance, version=6)
|
||||
except netaddr.AddrFormatError:
|
||||
msg = "%s is not an IPv6 address" % (instance)
|
||||
yield jsonschema.ValidationError(msg)
|
||||
elif format == "host-name":
|
||||
|
@ -31,7 +31,7 @@ class Base(object):
|
||||
|
||||
try:
|
||||
session.flush()
|
||||
except IntegrityError, e:
|
||||
except IntegrityError as e:
|
||||
non_unique_strings = (
|
||||
'duplicate entry',
|
||||
'not unique'
|
||||
|
@ -97,7 +97,7 @@ def ping_listener(dbapi_conn, connection_rec, connection_proxy):
|
||||
"""
|
||||
try:
|
||||
dbapi_conn.cursor().execute('select 1')
|
||||
except dbapi_conn.OperationalError, ex:
|
||||
except dbapi_conn.OperationalError as ex:
|
||||
if ex.args[0] in (2006, 2013, 2014, 2045, 2055):
|
||||
LOG.warn('Got mysql server has gone away: %s', ex)
|
||||
raise DisconnectionError("Database server went away")
|
||||
@ -169,7 +169,7 @@ def get_engine(config_group):
|
||||
|
||||
try:
|
||||
_ENGINES[config_group].connect()
|
||||
except OperationalError, e:
|
||||
except OperationalError as e:
|
||||
if not is_db_connection_error(e.args[0]):
|
||||
raise
|
||||
|
||||
@ -185,7 +185,7 @@ def get_engine(config_group):
|
||||
try:
|
||||
_ENGINES[config_group].connect()
|
||||
break
|
||||
except OperationalError, e:
|
||||
except OperationalError as e:
|
||||
if (remaining != 'infinite' and remaining == 0) or \
|
||||
not is_db_connection_error(e.args[0]):
|
||||
raise
|
||||
|
@ -28,13 +28,13 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
def create_tables(tables):
|
||||
for table in tables:
|
||||
LOG.debug("Creating table %(table)s" % locals())
|
||||
LOG.debug("Creating table %s" % table)
|
||||
table.create()
|
||||
|
||||
|
||||
def drop_tables(tables):
|
||||
for table in tables:
|
||||
LOG.debug("Dropping table %(table)s" % locals())
|
||||
LOG.debug("Dropping table %s" % table)
|
||||
table.drop()
|
||||
|
||||
|
||||
|
@ -1,19 +1,19 @@
|
||||
cliff>=1.4
|
||||
d2to1>=0.2.10,<0.3
|
||||
eventlet>=0.9.12
|
||||
eventlet>=0.12.0
|
||||
extras
|
||||
flask==0.9
|
||||
ipaddr
|
||||
Flask==0.9
|
||||
iso8601>=0.1.4
|
||||
jsonschema>=1.0.0,!=1.4.0,<2
|
||||
kombu>2.4.7
|
||||
kombu>=2.4.8
|
||||
netaddr
|
||||
oslo.config>=1.1.0
|
||||
paste
|
||||
pastedeploy>=1.5.0
|
||||
Paste
|
||||
PasteDeploy>=1.5.0
|
||||
pbr>=0.5.16,<0.6
|
||||
python-keystoneclient>=0.2,<0.3
|
||||
routes>=1.12.3
|
||||
sqlalchemy>=0.7,<=0.7.99
|
||||
python-keystoneclient>=0.3.0
|
||||
Routes>=1.12.3
|
||||
SQLAlchemy>=0.7,<=0.7.99
|
||||
sqlalchemy-migrate>=0.7
|
||||
stevedore>=0.9
|
||||
webob>=1.0.8
|
||||
stevedore>=0.10
|
||||
WebOb>=1.2.3,<1.3
|
||||
|
@ -1,6 +1,6 @@
|
||||
coverage>=3.6
|
||||
flake8==2.0
|
||||
hacking>=0.5.3,<0.6
|
||||
hacking>=0.5.6,<0.7
|
||||
mock>=0.8.0
|
||||
mox>=0.5.3
|
||||
nose
|
||||
|
Loading…
x
Reference in New Issue
Block a user