diff --git a/designate/__init__.py b/designate/__init__.py index d68a08c72..45dfced4b 100644 --- a/designate/__init__.py +++ b/designate/__init__.py @@ -17,7 +17,7 @@ import os # Eventlet's GreenDNS Patching will prevent the resolution of names in # the /etc/hosts file, causing problems for installs. -os.environ['EVENTLET_NO_GREENDNS'] = 'yes' +os.environ['EVENTLET_NO_GREENDNS'] = 'yes' # noqa from oslo_log import log from oslo_concurrency import lockutils diff --git a/designate/api/middleware.py b/designate/api/middleware.py index a67c452a9..5860594be 100644 --- a/designate/api/middleware.py +++ b/designate/api/middleware.py @@ -207,8 +207,8 @@ class MaintenanceMiddleware(base.Middleware): return None # If the caller has the bypass role, let them through - if ('context' in request.environ - and self.role in request.environ['context'].roles): + if ('context' in request.environ and + self.role in request.environ['context'].roles): LOG.warning('Request authorized to bypass maintenance mode') return None diff --git a/designate/central/service.py b/designate/central/service.py index 892805d3f..169f7fbe5 100644 --- a/designate/central/service.py +++ b/designate/central/service.py @@ -317,8 +317,8 @@ class Service(service.RPCService, service.Service): raise exceptions.InvalidRecordSetName('Name too long') # RecordSets must be contained in the parent zone - if (recordset_name != zone['name'] - and not recordset_name.endswith("." + zone['name'])): + if (recordset_name != zone['name'] and + not recordset_name.endswith("." + zone['name'])): raise exceptions.InvalidRecordSetLocation( 'RecordSet is not contained within it\'s parent zone') @@ -340,8 +340,8 @@ class Service(service.RPCService, service.Service): recordsets = self.storage.find_recordsets(context, criterion) - if ((len(recordsets) == 1 and recordsets[0].id != recordset_id) - or len(recordsets) > 1): + if ((len(recordsets) == 1 and recordsets[0].id != recordset_id) or + len(recordsets) > 1): raise exceptions.InvalidRecordSetLocation( 'CNAME recordsets may not share a name with any other records') diff --git a/designate/conf/__init__.py b/designate/conf/__init__.py index 063889e10..5c402980b 100644 --- a/designate/conf/__init__.py +++ b/designate/conf/__init__.py @@ -11,15 +11,9 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - from oslo_config import cfg -CONF = cfg.CONF - from designate.conf import base # noqa - -base.register_opts(CONF) # noqa - from designate.conf import akamai from designate.conf import agent from designate.conf import api @@ -45,6 +39,9 @@ from designate.conf import sink from designate.conf import storage from designate.conf import worker +CONF = cfg.CONF + +base.register_opts(CONF) akamai.register_opts(CONF) agent.register_opts(CONF) api.register_opts(CONF) diff --git a/designate/hacking/checks.py b/designate/hacking/checks.py index e092a0d4d..e2bf40edb 100644 --- a/designate/hacking/checks.py +++ b/designate/hacking/checks.py @@ -14,8 +14,7 @@ # under the License. import re -import pep8 - +import pycodestyle # D701: Default parameter value is a mutable type # D702: Log messages require translation @@ -27,7 +26,6 @@ import pep8 # D708: Do not use xrange. Use range, or six.moves.range for large loops. # D709: LOG.audit is deprecated, please use LOG.info! - UNDERSCORE_IMPORT_FILES = [] @@ -47,7 +45,7 @@ graduated_oslo_libraries_import_re = re.compile( def mutable_default_arguments(logical_line, physical_line, filename): - if pep8.noqa(physical_line): + if pycodestyle.noqa(physical_line): return if mutable_default_argument_check.match(logical_line): diff --git a/designate/mdns/notify.py b/designate/mdns/notify.py index 4aa017d1e..a8f54b05c 100644 --- a/designate/mdns/notify.py +++ b/designate/mdns/notify.py @@ -127,9 +127,10 @@ class NotifyEndpoint(base.BaseEndpoint): response, retry_cnt = self._make_and_send_dns_message( zone, host, port, timeout, retry_interval, retries_left) - if response and (response.rcode() in ( - dns.rcode.NXDOMAIN, dns.rcode.REFUSED, dns.rcode.SERVFAIL) - or not bool(response.answer)): + if response and (response.rcode() in (dns.rcode.NXDOMAIN, + dns.rcode.REFUSED, + dns.rcode.SERVFAIL) or + not bool(response.answer)): status = 'NO_ZONE' if zone.serial == 0 and zone.action in ('DELETE', 'NONE'): actual_serial = 0 diff --git a/designate/objects/base.py b/designate/objects/base.py index 10f29ed17..de7fa822c 100644 --- a/designate/objects/base.py +++ b/designate/objects/base.py @@ -128,13 +128,13 @@ class DesignateObject(base.VersionedObject): def __setattr__(self, name, value): """Enforces all object attributes are private or well defined""" - if not (name[0:5] == '_obj_' - or name[0:7] == '_change' - or name == '_context' - or name in list(six.iterkeys(self.fields)) - or name == 'FIELDS' - or name == 'VERSION' - or name == 'fields'): + if not (name[0:5] == '_obj_' or + name[0:7] == '_change' or + name == '_context' or + name in list(six.iterkeys(self.fields)) or + name == 'FIELDS' or + name == 'VERSION' or + name == 'fields'): raise AttributeError( "Designate object '%(type)s' has no" "attribute '%(name)s'" % { @@ -507,9 +507,9 @@ class DesignateRegistry(base.VersionedObjectRegistry): self._changed_fields.add(name) # TODO(daidv): _obj_original_values shoud be removed # after OVO migration completed. - if (self.obj_attr_is_set(name) and value != getattr(self, name) - and name not in list(six.iterkeys( - self._obj_original_values))): + if (self.obj_attr_is_set(name) and + value != getattr(self, name) and + name not in list(six.iterkeys(self._obj_original_values))): # noqa self._obj_original_values[name] = getattr(self, name) try: return setattr(self, attrname, field_value) diff --git a/designate/objects/fields.py b/designate/objects/fields.py index 6fa9a6913..19a52c0d0 100644 --- a/designate/objects/fields.py +++ b/designate/objects/fields.py @@ -93,11 +93,9 @@ class IntegerFields(IntegerField): class StringFields(ovoo_fields.StringField): RE_HOSTNAME = r'^(?!.{255,})(?:(?:^\*|(?!\-)[A-Za-z0-9_\-]{1,63})(?=0.12.0 # Apache-2.0 +hacking>=1.1.0,<1.2.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD mock>=2.0.0 # BSD