Enabled hacking check H401
* [H401] Docstrings should not start with a space. Change-Id: I1e98718a6612aea04453904fa4eca892a1dd1744
This commit is contained in:
parent
4589f60902
commit
6652bcc842
|
@ -38,7 +38,7 @@ cfg.CONF.register_opts([
|
|||
|
||||
|
||||
class SampleHandler(NotificationHandler):
|
||||
""" Sample Handler """
|
||||
"""Sample Handler"""
|
||||
__plugin_name__ = 'sample'
|
||||
|
||||
def get_exchange_topics(self):
|
||||
|
|
|
@ -122,7 +122,7 @@ def factory(global_config, **local_conf):
|
|||
|
||||
|
||||
class UUIDConverter(BaseConverter):
|
||||
""" Validates UUID URL paramaters """
|
||||
"""Validates UUID URL paramaters"""
|
||||
|
||||
def to_python(self, value):
|
||||
if not utils.is_uuid_like(value):
|
||||
|
|
|
@ -36,7 +36,7 @@ class BlacklistsController(rest.RestController):
|
|||
@pecan.expose(template='json:', content_type='application/json')
|
||||
@utils.validate_uuid('blacklist_id')
|
||||
def get_one(self, blacklist_id):
|
||||
""" Get Blacklist """
|
||||
"""Get Blacklist"""
|
||||
|
||||
request = pecan.request
|
||||
context = request.environ['context']
|
||||
|
@ -47,7 +47,7 @@ class BlacklistsController(rest.RestController):
|
|||
|
||||
@pecan.expose(template='json:', content_type='application/json')
|
||||
def get_all(self, **params):
|
||||
""" List all Blacklisted Zones """
|
||||
"""List all Blacklisted Zones"""
|
||||
request = pecan.request
|
||||
context = request.environ['context']
|
||||
|
||||
|
@ -66,7 +66,7 @@ class BlacklistsController(rest.RestController):
|
|||
|
||||
@pecan.expose(template='json:', content_type='application/json')
|
||||
def post_all(self):
|
||||
""" Create Blacklisted Zone """
|
||||
"""Create Blacklisted Zone"""
|
||||
request = pecan.request
|
||||
response = pecan.response
|
||||
context = request.environ['context']
|
||||
|
@ -95,7 +95,7 @@ class BlacklistsController(rest.RestController):
|
|||
@pecan.expose(template='json:', content_type='application/json-patch+json')
|
||||
@utils.validate_uuid('blacklist_id')
|
||||
def patch_one(self, blacklist_id):
|
||||
""" Update Blacklisted Zone """
|
||||
"""Update Blacklisted Zone"""
|
||||
request = pecan.request
|
||||
context = request.environ['context']
|
||||
body = request.body_dict
|
||||
|
@ -127,7 +127,7 @@ class BlacklistsController(rest.RestController):
|
|||
@pecan.expose(template=None, content_type='application/json')
|
||||
@utils.validate_uuid('blacklist_id')
|
||||
def delete_one(self, blacklist_id):
|
||||
""" Delete Blacklisted Zone """
|
||||
"""Delete Blacklisted Zone"""
|
||||
request = pecan.request
|
||||
response = pecan.response
|
||||
context = request.environ['context']
|
||||
|
|
|
@ -42,7 +42,7 @@ class QuotasController(rest.RestController):
|
|||
|
||||
@pecan.expose(template='json:', content_type='application/json')
|
||||
def patch_one(self, tenant_id):
|
||||
""" Modify a Quota """
|
||||
"""Modify a Quota"""
|
||||
request = pecan.request
|
||||
response = pecan.response
|
||||
context = request.environ['context']
|
||||
|
@ -65,7 +65,7 @@ class QuotasController(rest.RestController):
|
|||
|
||||
@pecan.expose(template=None, content_type='application/json')
|
||||
def delete_one(self, tenant_id):
|
||||
""" Reset to the Default Quotas """
|
||||
"""Reset to the Default Quotas"""
|
||||
request = pecan.request
|
||||
response = pecan.response
|
||||
context = request.environ['context']
|
||||
|
|
|
@ -46,7 +46,7 @@ class FloatingIPController(rest.RestController):
|
|||
|
||||
@pecan.expose(template='json:', content_type='application/json')
|
||||
def get_all(self, **params):
|
||||
""" List Floating IP PTRs for a Tenant """
|
||||
"""List Floating IP PTRs for a Tenant"""
|
||||
request = pecan.request
|
||||
context = request.environ['context']
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class RecordsController(rest.RestController):
|
|||
@pecan.expose(template='json:', content_type='application/json')
|
||||
@utils.validate_uuid('zone_id', 'recordset_id', 'record_id')
|
||||
def get_one(self, zone_id, recordset_id, record_id):
|
||||
""" Get Record """
|
||||
"""Get Record"""
|
||||
request = pecan.request
|
||||
context = request.environ['context']
|
||||
|
||||
|
@ -48,7 +48,7 @@ class RecordsController(rest.RestController):
|
|||
@pecan.expose(template='json:', content_type='application/json')
|
||||
@utils.validate_uuid('zone_id', 'recordset_id')
|
||||
def get_all(self, zone_id, recordset_id, **params):
|
||||
""" List Records """
|
||||
"""List Records"""
|
||||
request = pecan.request
|
||||
context = request.environ['context']
|
||||
|
||||
|
@ -72,7 +72,7 @@ class RecordsController(rest.RestController):
|
|||
@pecan.expose(template='json:', content_type='application/json')
|
||||
@utils.validate_uuid('zone_id', 'recordset_id')
|
||||
def post_all(self, zone_id, recordset_id):
|
||||
""" Create Record """
|
||||
"""Create Record"""
|
||||
request = pecan.request
|
||||
response = pecan.response
|
||||
context = request.environ['context']
|
||||
|
@ -105,7 +105,7 @@ class RecordsController(rest.RestController):
|
|||
@pecan.expose(template='json:', content_type='application/json-patch+json')
|
||||
@utils.validate_uuid('zone_id', 'recordset_id', 'record_id')
|
||||
def patch_one(self, zone_id, recordset_id, record_id):
|
||||
""" Update Record """
|
||||
"""Update Record"""
|
||||
request = pecan.request
|
||||
context = request.environ['context']
|
||||
body = request.body_dict
|
||||
|
@ -140,7 +140,7 @@ class RecordsController(rest.RestController):
|
|||
@pecan.expose(template=None, content_type='application/json')
|
||||
@utils.validate_uuid('zone_id', 'recordset_id', 'record_id')
|
||||
def delete_one(self, zone_id, recordset_id, record_id):
|
||||
""" Delete Record """
|
||||
"""Delete Record"""
|
||||
request = pecan.request
|
||||
response = pecan.response
|
||||
context = request.environ['context']
|
||||
|
|
|
@ -39,7 +39,7 @@ class RecordSetsController(rest.RestController):
|
|||
@pecan.expose(template='json:', content_type='application/json')
|
||||
@utils.validate_uuid('zone_id', 'recordset_id')
|
||||
def get_one(self, zone_id, recordset_id):
|
||||
""" Get RecordSet """
|
||||
"""Get RecordSet"""
|
||||
request = pecan.request
|
||||
context = request.environ['context']
|
||||
|
||||
|
@ -51,7 +51,7 @@ class RecordSetsController(rest.RestController):
|
|||
@pecan.expose(template='json:', content_type='application/json')
|
||||
@utils.validate_uuid('zone_id')
|
||||
def get_all(self, zone_id, **params):
|
||||
""" List RecordSets """
|
||||
"""List RecordSets"""
|
||||
request = pecan.request
|
||||
context = request.environ['context']
|
||||
|
||||
|
@ -73,7 +73,7 @@ class RecordSetsController(rest.RestController):
|
|||
@pecan.expose(template='json:', content_type='application/json')
|
||||
@utils.validate_uuid('zone_id')
|
||||
def post_all(self, zone_id):
|
||||
""" Create RecordSet """
|
||||
"""Create RecordSet"""
|
||||
request = pecan.request
|
||||
response = pecan.response
|
||||
context = request.environ['context']
|
||||
|
@ -102,7 +102,7 @@ class RecordSetsController(rest.RestController):
|
|||
@pecan.expose(template='json:', content_type='application/json-patch+json')
|
||||
@utils.validate_uuid('zone_id', 'recordset_id')
|
||||
def patch_one(self, zone_id, recordset_id):
|
||||
""" Update RecordSet """
|
||||
"""Update RecordSet"""
|
||||
request = pecan.request
|
||||
context = request.environ['context']
|
||||
body = request.body_dict
|
||||
|
@ -134,7 +134,7 @@ class RecordSetsController(rest.RestController):
|
|||
@pecan.expose(template=None, content_type='application/json')
|
||||
@utils.validate_uuid('zone_id', 'recordset_id')
|
||||
def delete_one(self, zone_id, recordset_id):
|
||||
""" Delete RecordSet """
|
||||
"""Delete RecordSet"""
|
||||
request = pecan.request
|
||||
response = pecan.response
|
||||
context = request.environ['context']
|
||||
|
|
|
@ -34,7 +34,7 @@ class TldsController(rest.RestController):
|
|||
@pecan.expose(template='json:', content_type='application/json')
|
||||
@utils.validate_uuid('tld_id')
|
||||
def get_one(self, tld_id):
|
||||
""" Get Tld """
|
||||
"""Get Tld"""
|
||||
|
||||
request = pecan.request
|
||||
context = request.environ['context']
|
||||
|
@ -44,7 +44,7 @@ class TldsController(rest.RestController):
|
|||
|
||||
@pecan.expose(template='json:', content_type='application/json')
|
||||
def get_all(self, **params):
|
||||
""" List Tlds """
|
||||
"""List Tlds"""
|
||||
request = pecan.request
|
||||
context = request.environ['context']
|
||||
|
||||
|
@ -63,7 +63,7 @@ class TldsController(rest.RestController):
|
|||
|
||||
@pecan.expose(template='json:', content_type='application/json')
|
||||
def post_all(self):
|
||||
""" Create Tld """
|
||||
"""Create Tld"""
|
||||
request = pecan.request
|
||||
response = pecan.response
|
||||
context = request.environ['context']
|
||||
|
@ -88,7 +88,7 @@ class TldsController(rest.RestController):
|
|||
@pecan.expose(template='json:', content_type='application/json-patch+json')
|
||||
@utils.validate_uuid('tld_id')
|
||||
def patch_one(self, tld_id):
|
||||
""" Update Tld """
|
||||
"""Update Tld"""
|
||||
request = pecan.request
|
||||
context = request.environ['context']
|
||||
body = request.body_dict
|
||||
|
@ -118,7 +118,7 @@ class TldsController(rest.RestController):
|
|||
@pecan.expose(template=None, content_type='application/json')
|
||||
@utils.validate_uuid('tld_id')
|
||||
def delete_one(self, tld_id):
|
||||
""" Delete Tld """
|
||||
"""Delete Tld"""
|
||||
request = pecan.request
|
||||
response = pecan.response
|
||||
context = request.environ['context']
|
||||
|
|
|
@ -48,7 +48,7 @@ class ZonesController(rest.RestController):
|
|||
@pecan.expose(template=None, content_type='text/dns')
|
||||
@utils.validate_uuid('zone_id')
|
||||
def get_one(self, zone_id):
|
||||
""" Get Zone """
|
||||
"""Get Zone"""
|
||||
# TODO(kiall): Validate we have a sane UUID for zone_id
|
||||
|
||||
request = pecan.request
|
||||
|
@ -66,13 +66,13 @@ class ZonesController(rest.RestController):
|
|||
'Accept must be text/dns or application/json')
|
||||
|
||||
def _get_json(self, request, context, zone_id):
|
||||
""" 'Normal' zone get """
|
||||
"""'Normal' zone get"""
|
||||
zone = self.central_api.get_domain(context, zone_id)
|
||||
|
||||
return self._view.show(context, request, zone)
|
||||
|
||||
def _get_zonefile(self, request, context, zone_id):
|
||||
""" Export zonefile """
|
||||
"""Export zonefile"""
|
||||
servers = self.central_api.get_domain_servers(context, zone_id)
|
||||
domain = self.central_api.get_domain(context, zone_id)
|
||||
|
||||
|
@ -105,7 +105,7 @@ class ZonesController(rest.RestController):
|
|||
|
||||
@pecan.expose(template='json:', content_type='application/json')
|
||||
def get_all(self, **params):
|
||||
""" List Zones """
|
||||
"""List Zones"""
|
||||
request = pecan.request
|
||||
context = request.environ['context']
|
||||
|
||||
|
@ -123,7 +123,7 @@ class ZonesController(rest.RestController):
|
|||
|
||||
@pecan.expose(template='json:', content_type='application/json')
|
||||
def post_all(self):
|
||||
""" Create Zone """
|
||||
"""Create Zone"""
|
||||
request = pecan.request
|
||||
response = pecan.response
|
||||
context = request.environ['context']
|
||||
|
@ -136,7 +136,7 @@ class ZonesController(rest.RestController):
|
|||
'Content-type must be text/dns or application/json')
|
||||
|
||||
def _post_json(self, request, response, context):
|
||||
""" 'Normal' zone creation """
|
||||
"""'Normal' zone creation"""
|
||||
body = request.body_dict
|
||||
|
||||
# Validate the request conforms to the schema
|
||||
|
@ -163,7 +163,7 @@ class ZonesController(rest.RestController):
|
|||
return self._view.show(context, request, zone)
|
||||
|
||||
def _post_zonefile(self, request, response, context):
|
||||
""" Import Zone """
|
||||
"""Import Zone"""
|
||||
dnspython_zone = self._parse_zonefile(request)
|
||||
# TODO(artom) This should probably be handled with transactions
|
||||
zone = self._create_zone(context, dnspython_zone)
|
||||
|
@ -187,7 +187,7 @@ class ZonesController(rest.RestController):
|
|||
@pecan.expose(template='json:', content_type='application/json-patch+json')
|
||||
@utils.validate_uuid('zone_id')
|
||||
def patch_one(self, zone_id):
|
||||
""" Update Zone """
|
||||
"""Update Zone"""
|
||||
# TODO(kiall): This needs cleanup to say the least..
|
||||
request = pecan.request
|
||||
context = request.environ['context']
|
||||
|
@ -235,7 +235,7 @@ class ZonesController(rest.RestController):
|
|||
@pecan.expose(template=None, content_type='application/json')
|
||||
@utils.validate_uuid('zone_id')
|
||||
def delete_one(self, zone_id):
|
||||
""" Delete Zone """
|
||||
"""Delete Zone"""
|
||||
request = pecan.request
|
||||
response = pecan.response
|
||||
context = request.environ['context']
|
||||
|
@ -256,7 +256,7 @@ class ZonesController(rest.RestController):
|
|||
# somewhere reusable.
|
||||
|
||||
def _create_zone(self, context, dnspython_zone):
|
||||
""" Creates the initial zone """
|
||||
"""Creates the initial zone"""
|
||||
# dnspython never builds a zone with more than one SOA, even if we give
|
||||
# it a zonefile that contains more than one
|
||||
soa = dnspython_zone.get_rdataset(dnspython_zone.origin, 'SOA')
|
||||
|
@ -289,7 +289,7 @@ class ZonesController(rest.RestController):
|
|||
}
|
||||
|
||||
def _create_records(self, context, zone_id, dnspython_zone):
|
||||
""" Creates the records """
|
||||
"""Creates the records"""
|
||||
for record_name in dnspython_zone.nodes.keys():
|
||||
for rdataset in dnspython_zone.nodes[record_name]:
|
||||
record_type = rdatatype.to_text(rdataset.rdtype)
|
||||
|
@ -325,7 +325,7 @@ class ZonesController(rest.RestController):
|
|||
Record(**values))
|
||||
|
||||
def _parse_zonefile(self, request):
|
||||
""" Parses a POSTed zonefile into a dnspython zone object """
|
||||
"""Parses a POSTed zonefile into a dnspython zone object"""
|
||||
try:
|
||||
dnspython_zone = dnszone.from_text(
|
||||
request.body,
|
||||
|
|
|
@ -44,7 +44,7 @@ class BaseView(object):
|
|||
self.base_uri = CONF['service:api']['api_base_uri'].rstrip('/')
|
||||
|
||||
def list(self, context, request, items, parents=None):
|
||||
""" View of a list of items """
|
||||
"""View of a list of items"""
|
||||
result = {
|
||||
"links": self._get_collection_links(request, items, parents)
|
||||
}
|
||||
|
@ -59,15 +59,15 @@ class BaseView(object):
|
|||
return result
|
||||
|
||||
def list_basic(self, context, request, items):
|
||||
""" Non-detailed list of items """
|
||||
"""Non-detailed list of items"""
|
||||
return [self.show_basic(context, request, i) for i in items]
|
||||
|
||||
def list_detail(self, context, request, items):
|
||||
""" Detailed list of items """
|
||||
"""Detailed list of items"""
|
||||
return [self.show_detail(context, request, i) for i in items]
|
||||
|
||||
def show(self, context, request, item):
|
||||
""" Show a single item """
|
||||
"""Show a single item"""
|
||||
result = {}
|
||||
|
||||
if 'detail' in request.GET and request.GET['detail'] == 'yes':
|
||||
|
@ -80,15 +80,15 @@ class BaseView(object):
|
|||
return result
|
||||
|
||||
def show_basic(self, context, request, item):
|
||||
""" Non-detailed view of a item """
|
||||
"""Non-detailed view of a item"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def show_detail(self, context, request, item):
|
||||
""" Detailed view of a item """
|
||||
"""Detailed view of a item"""
|
||||
return self.show_basic(context, request, item)
|
||||
|
||||
def _load(self, context, request, body, valid_keys):
|
||||
""" Extract a "central" compatible dict from an API call """
|
||||
"""Extract a "central" compatible dict from an API call"""
|
||||
result = {}
|
||||
item = body[self._resource_name]
|
||||
error_keys = []
|
||||
|
|
|
@ -22,13 +22,13 @@ LOG = logging.getLogger(__name__)
|
|||
|
||||
|
||||
class BlacklistsView(base_view.BaseView):
|
||||
""" Model a Blacklist API response as a python dictionary """
|
||||
"""Model a Blacklist API response as a python dictionary"""
|
||||
|
||||
_resource_name = 'blacklist'
|
||||
_collection_name = 'blacklists'
|
||||
|
||||
def show_basic(self, context, request, blacklist):
|
||||
""" Detailed view of a blacklisted zone """
|
||||
"""Detailed view of a blacklisted zone"""
|
||||
return {
|
||||
"id": blacklist['id'],
|
||||
"pattern": blacklist['pattern'],
|
||||
|
@ -39,6 +39,6 @@ class BlacklistsView(base_view.BaseView):
|
|||
}
|
||||
|
||||
def load(self, context, request, body):
|
||||
""" Extract a "central" compatible dict from an API call """
|
||||
"""Extract a "central" compatible dict from an API call"""
|
||||
valid_keys = ('pattern', 'description')
|
||||
return self._load(context, request, body, valid_keys)
|
||||
|
|
|
@ -21,13 +21,13 @@ LOG = logging.getLogger(__name__)
|
|||
|
||||
|
||||
class QuotasView(base_view.BaseView):
|
||||
""" Model a Quota API response as a python dictionary """
|
||||
"""Model a Quota API response as a python dictionary"""
|
||||
|
||||
_resource_name = 'quota'
|
||||
_collection_name = 'quotas'
|
||||
|
||||
def show_basic(self, context, request, quota):
|
||||
""" Basic view of a quota """
|
||||
"""Basic view of a quota"""
|
||||
return {
|
||||
"zones": quota['domains'],
|
||||
"zone_records": quota['domain_records'],
|
||||
|
@ -36,7 +36,7 @@ class QuotasView(base_view.BaseView):
|
|||
}
|
||||
|
||||
def load(self, context, request, body):
|
||||
""" Extract a "central" compatible dict from an API call """
|
||||
"""Extract a "central" compatible dict from an API call"""
|
||||
valid_keys = ('domain_records', 'domain_recordsets', 'domains',
|
||||
'recordset_records')
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ LOG = logging.getLogger(__name__)
|
|||
|
||||
|
||||
class FloatingIPView(base_view.BaseView):
|
||||
""" Model a FloatingIP PTR record as a python dict """
|
||||
"""Model a FloatingIP PTR record as a python dict"""
|
||||
_resource_name = 'floatingip'
|
||||
_collection_name = 'floatingips'
|
||||
|
||||
|
|
|
@ -21,13 +21,13 @@ LOG = logging.getLogger(__name__)
|
|||
|
||||
|
||||
class LimitsView(base_view.BaseView):
|
||||
""" Model a Limits API response as a python dictionary """
|
||||
"""Model a Limits API response as a python dictionary"""
|
||||
|
||||
_resource_name = 'limits'
|
||||
_collection_name = 'limits'
|
||||
|
||||
def show_basic(self, context, request, absolute_limits):
|
||||
""" Basic view of the limits """
|
||||
"""Basic view of the limits"""
|
||||
|
||||
return {
|
||||
"absolute": {
|
||||
|
|
|
@ -22,7 +22,7 @@ LOG = logging.getLogger(__name__)
|
|||
|
||||
|
||||
class NameServerView(base_view.BaseView):
|
||||
""" Model a NameServer API response as a python dictionary """
|
||||
"""Model a NameServer API response as a python dictionary"""
|
||||
|
||||
_resource_name = 'nameserver'
|
||||
_collection_name = 'nameservers'
|
||||
|
@ -35,7 +35,7 @@ class NameServerView(base_view.BaseView):
|
|||
return href.rstrip('?')
|
||||
|
||||
def show_basic(self, context, request, nameserver):
|
||||
""" Basic view of a nameserver """
|
||||
"""Basic view of a nameserver"""
|
||||
return {
|
||||
"id": nameserver["id"],
|
||||
"name": nameserver["name"]
|
||||
|
|
|
@ -21,7 +21,7 @@ LOG = logging.getLogger(__name__)
|
|||
|
||||
|
||||
class RecordsView(base_view.BaseView):
|
||||
""" Model a Record API response as a python dictionary """
|
||||
"""Model a Record API response as a python dictionary"""
|
||||
|
||||
_resource_name = 'record'
|
||||
_collection_name = 'records'
|
||||
|
@ -36,7 +36,7 @@ class RecordsView(base_view.BaseView):
|
|||
return href.rstrip('?')
|
||||
|
||||
def show_basic(self, context, request, record):
|
||||
""" Basic view of a record """
|
||||
"""Basic view of a record"""
|
||||
return {
|
||||
"id": record['id'],
|
||||
"recordset_id": record['recordset_id'],
|
||||
|
@ -51,6 +51,6 @@ class RecordsView(base_view.BaseView):
|
|||
}
|
||||
|
||||
def load(self, context, request, body):
|
||||
""" Extract a "central" compatible dict from an API call """
|
||||
"""Extract a "central" compatible dict from an API call"""
|
||||
valid_keys = ('data', 'description')
|
||||
return self._load(context, request, body, valid_keys)
|
||||
|
|
|
@ -21,7 +21,7 @@ LOG = logging.getLogger(__name__)
|
|||
|
||||
|
||||
class RecordSetsView(base_view.BaseView):
|
||||
""" Model a Zone API response as a python dictionary """
|
||||
"""Model a Zone API response as a python dictionary"""
|
||||
|
||||
_resource_name = 'recordset'
|
||||
_collection_name = 'recordsets'
|
||||
|
@ -34,7 +34,7 @@ class RecordSetsView(base_view.BaseView):
|
|||
return href.rstrip('?')
|
||||
|
||||
def show_basic(self, context, request, recordset):
|
||||
""" Basic view of a recordset """
|
||||
"""Basic view of a recordset"""
|
||||
return {
|
||||
"id": recordset['id'],
|
||||
"zone_id": recordset['domain_id'],
|
||||
|
@ -50,6 +50,6 @@ class RecordSetsView(base_view.BaseView):
|
|||
}
|
||||
|
||||
def load(self, context, request, body):
|
||||
""" Extract a "central" compatible dict from an API call """
|
||||
"""Extract a "central" compatible dict from an API call"""
|
||||
valid_keys = ('name', 'type', 'ttl', 'description')
|
||||
return self._load(context, request, body, valid_keys)
|
||||
|
|
|
@ -20,13 +20,13 @@ LOG = logging.getLogger(__name__)
|
|||
|
||||
|
||||
class TldsView(base_view.BaseView):
|
||||
""" Model a TLD API response as a python dictionary """
|
||||
"""Model a TLD API response as a python dictionary"""
|
||||
|
||||
_resource_name = 'tld'
|
||||
_collection_name = 'tlds'
|
||||
|
||||
def show_basic(self, context, request, tld):
|
||||
""" Basic view of a tld """
|
||||
"""Basic view of a tld"""
|
||||
return {
|
||||
"id": tld['id'],
|
||||
"name": tld['name'],
|
||||
|
@ -37,6 +37,6 @@ class TldsView(base_view.BaseView):
|
|||
}
|
||||
|
||||
def load(self, context, request, body):
|
||||
""" Extract a "central" compatible dict from an API call """
|
||||
"""Extract a "central" compatible dict from an API call"""
|
||||
valid_keys = ('name', 'description')
|
||||
return self._load(context, request, body, valid_keys)
|
||||
|
|
|
@ -21,13 +21,13 @@ LOG = logging.getLogger(__name__)
|
|||
|
||||
|
||||
class ZonesView(base_view.BaseView):
|
||||
""" Model a Zone API response as a python dictionary """
|
||||
"""Model a Zone API response as a python dictionary"""
|
||||
|
||||
_resource_name = 'zone'
|
||||
_collection_name = 'zones'
|
||||
|
||||
def show_basic(self, context, request, zone):
|
||||
""" Basic view of a zone """
|
||||
"""Basic view of a zone"""
|
||||
# TODO(kiall): pool_id should not be hardcoded.. even temp :)
|
||||
return {
|
||||
"id": zone['id'],
|
||||
|
@ -46,6 +46,6 @@ class ZonesView(base_view.BaseView):
|
|||
}
|
||||
|
||||
def load(self, context, request, body):
|
||||
""" Extract a "central" compatible dict from an API call """
|
||||
"""Extract a "central" compatible dict from an API call"""
|
||||
valid_keys = ('name', 'email', 'description', 'ttl')
|
||||
return self._load(context, request, body, valid_keys)
|
||||
|
|
|
@ -26,7 +26,7 @@ LOG = logging.getLogger(__name__)
|
|||
|
||||
|
||||
class Backend(DriverPlugin):
|
||||
""" Base class for backend implementations """
|
||||
"""Base class for backend implementations"""
|
||||
__plugin_type__ = 'backend'
|
||||
__plugin_ns__ = 'designate.backend'
|
||||
|
||||
|
@ -43,66 +43,66 @@ class Backend(DriverPlugin):
|
|||
pass
|
||||
|
||||
def create_tsigkey(self, context, tsigkey):
|
||||
""" Create a TSIG Key """
|
||||
"""Create a TSIG Key"""
|
||||
raise exceptions.NotImplemented(
|
||||
'TSIG is not supported by this backend')
|
||||
|
||||
def update_tsigkey(self, context, tsigkey):
|
||||
""" Update a TSIG Key """
|
||||
"""Update a TSIG Key"""
|
||||
raise exceptions.NotImplemented(
|
||||
'TSIG is not supported by this backend')
|
||||
|
||||
def delete_tsigkey(self, context, tsigkey):
|
||||
""" Delete a TSIG Key """
|
||||
"""Delete a TSIG Key"""
|
||||
raise exceptions.NotImplemented(
|
||||
'TSIG is not supported by this backend')
|
||||
|
||||
@abc.abstractmethod
|
||||
def create_domain(self, context, domain):
|
||||
""" Create a DNS domain """
|
||||
"""Create a DNS domain"""
|
||||
|
||||
@abc.abstractmethod
|
||||
def update_domain(self, context, domain):
|
||||
""" Update a DNS domain """
|
||||
"""Update a DNS domain"""
|
||||
|
||||
@abc.abstractmethod
|
||||
def delete_domain(self, context, domain):
|
||||
""" Delete a DNS domain """
|
||||
"""Delete a DNS domain"""
|
||||
|
||||
def create_recordset(self, context, domain, recordset):
|
||||
""" Create a DNS recordset """
|
||||
"""Create a DNS recordset"""
|
||||
|
||||
@abc.abstractmethod
|
||||
def update_recordset(self, context, domain, recordset):
|
||||
""" Update a DNS recordset """
|
||||
"""Update a DNS recordset"""
|
||||
|
||||
@abc.abstractmethod
|
||||
def delete_recordset(self, context, domain, recordset):
|
||||
""" Delete a DNS recordset """
|
||||
"""Delete a DNS recordset"""
|
||||
|
||||
@abc.abstractmethod
|
||||
def create_record(self, context, domain, recordset, record):
|
||||
""" Create a DNS record """
|
||||
"""Create a DNS record"""
|
||||
|
||||
@abc.abstractmethod
|
||||
def update_record(self, context, domain, recordset, record):
|
||||
""" Update a DNS record """
|
||||
"""Update a DNS record"""
|
||||
|
||||
@abc.abstractmethod
|
||||
def delete_record(self, context, domain, recordset, record):
|
||||
""" Delete a DNS record """
|
||||
"""Delete a DNS record"""
|
||||
|
||||
@abc.abstractmethod
|
||||
def create_server(self, context, server):
|
||||
""" Create a DNS server """
|
||||
"""Create a DNS server"""
|
||||
|
||||
@abc.abstractmethod
|
||||
def update_server(self, context, server):
|
||||
""" Update a DNS server """
|
||||
"""Update a DNS server"""
|
||||
|
||||
@abc.abstractmethod
|
||||
def delete_server(self, context, server):
|
||||
""" Delete a DNS server """
|
||||
"""Delete a DNS server"""
|
||||
|
||||
def sync_domain(self, context, domain, rdata):
|
||||
"""
|
||||
|
@ -152,7 +152,7 @@ class Backend(DriverPlugin):
|
|||
self.create_record(context, domain, recordset, record)
|
||||
|
||||
def ping(self, context):
|
||||
""" Ping the Backend service """
|
||||
"""Ping the Backend service"""
|
||||
|
||||
return {
|
||||
'status': None
|
||||
|
|
|
@ -128,7 +128,7 @@ class Bind9Backend(base.Backend):
|
|||
return rndc_call
|
||||
|
||||
def _sync_delete_domain(self, domain, new_domain_flag=False):
|
||||
""" Remove domain zone files and reload bind config """
|
||||
"""Remove domain zone files and reload bind config"""
|
||||
LOG.debug('Delete Domain: %s' % domain['id'])
|
||||
|
||||
output_folder = os.path.join(os.path.abspath(cfg.CONF.state_path),
|
||||
|
@ -156,7 +156,7 @@ class Bind9Backend(base.Backend):
|
|||
shutil.copyfile(nzf_name[0], output_file)
|
||||
|
||||
def _sync_domain(self, domain, new_domain_flag=False):
|
||||
""" Sync a single domain's zone file and reload bind config """
|
||||
"""Sync a single domain's zone file and reload bind config"""
|
||||
LOG.debug('Synchronising Domain: %s' % domain['id'])
|
||||
|
||||
servers = self.central_service.find_servers(self.admin_context)
|
||||
|
|
|
@ -64,7 +64,7 @@ class PowerDNSBackend(base.Backend):
|
|||
|
||||
# TSIG Key Methods
|
||||
def create_tsigkey(self, context, tsigkey):
|
||||
""" Create a TSIG Key """
|
||||
"""Create a TSIG Key"""
|
||||
|
||||
if tsigkey['algorithm'] not in TSIG_SUPPORTED_ALGORITHMS:
|
||||
raise exceptions.NotImplemented('Unsupported algorithm')
|
||||
|
@ -104,7 +104,7 @@ class PowerDNSBackend(base.Backend):
|
|||
self.session.commit()
|
||||
|
||||
def update_tsigkey(self, context, tsigkey):
|
||||
""" Update a TSIG Key """
|
||||
"""Update a TSIG Key"""
|
||||
tsigkey_m = self._get_tsigkey(tsigkey['id'])
|
||||
|
||||
# Store a copy of the original name..
|
||||
|
@ -125,7 +125,7 @@ class PowerDNSBackend(base.Backend):
|
|||
.update(content=tsigkey['name'])
|
||||
|
||||
def delete_tsigkey(self, context, tsigkey):
|
||||
""" Delete a TSIG Key """
|
||||
"""Delete a TSIG Key"""
|
||||
try:
|
||||
# Delete this TSIG Key itself
|
||||
tsigkey_m = self._get_tsigkey(tsigkey['id'])
|
||||
|
@ -336,7 +336,7 @@ class PowerDNSBackend(base.Backend):
|
|||
record_m.save(self.session)
|
||||
|
||||
def _update_domainmetadata(self, domain_id, kind, values=[], delete=True):
|
||||
""" Updates a domain's metadata with new values """
|
||||
"""Updates a domain's metadata with new values"""
|
||||
# Fetch all current metadata of the specified kind
|
||||
query = self.session.query(models.DomainMetadata)
|
||||
query = query.filter_by(domain_id=domain_id, kind=kind)
|
||||
|
|
|
@ -48,7 +48,7 @@ class RequestHandler(object):
|
|||
return response.to_wire()
|
||||
|
||||
def _handle_query(self, request):
|
||||
""" Handle a DNS QUERY request """
|
||||
"""Handle a DNS QUERY request"""
|
||||
response = dns.message.make_response(request)
|
||||
response.set_rcode(dns.rcode.SERVFAIL)
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ def get_ip_data(addr_dict):
|
|||
|
||||
|
||||
class NotificationHandler(ExtensionPlugin):
|
||||
""" Base class for notification handlers """
|
||||
"""Base class for notification handlers"""
|
||||
__plugin_ns__ = 'designate.notification.handler'
|
||||
__plugin_type__ = 'handler'
|
||||
|
||||
|
@ -71,7 +71,7 @@ class NotificationHandler(ExtensionPlugin):
|
|||
|
||||
@abc.abstractmethod
|
||||
def process_notification(self, context, event_type, payload):
|
||||
""" Processes a given notification """
|
||||
"""Processes a given notification"""
|
||||
|
||||
def get_domain(self, domain_id):
|
||||
"""
|
||||
|
|
|
@ -35,7 +35,7 @@ cfg.CONF.register_opts([
|
|||
|
||||
|
||||
class NeutronFloatingHandler(BaseAddressHandler):
|
||||
""" Handler for Neutron's notifications """
|
||||
"""Handler for Neutron's notifications"""
|
||||
__plugin_name__ = 'neutron_floatingip'
|
||||
|
||||
def get_exchange_topics(self):
|
||||
|
|
|
@ -35,7 +35,7 @@ cfg.CONF.register_opts([
|
|||
|
||||
|
||||
class NovaFixedHandler(BaseAddressHandler):
|
||||
""" Handler for Nova's notifications """
|
||||
"""Handler for Nova's notifications"""
|
||||
__plugin_name__ = 'nova_fixed'
|
||||
|
||||
def get_exchange_topics(self):
|
||||
|
|
|
@ -24,12 +24,12 @@ class NotSpecifiedSentinel:
|
|||
|
||||
|
||||
def get_attrname(name):
|
||||
""" Return the mangled name of the attribute's underlying storage. """
|
||||
"""Return the mangled name of the attribute's underlying storage."""
|
||||
return '_%s' % name
|
||||
|
||||
|
||||
def make_class_properties(cls):
|
||||
""" Build getter and setter methods for all the objects attributes """
|
||||
"""Build getter and setter methods for all the objects attributes"""
|
||||
cls.FIELDS = list(cls.FIELDS)
|
||||
|
||||
for supercls in cls.mro()[1:-1]:
|
||||
|
@ -88,7 +88,7 @@ class DictObjectMixin(object):
|
|||
return self[key]
|
||||
|
||||
def update(self, values):
|
||||
""" Make the model object behave like a dict """
|
||||
"""Make the model object behave like a dict"""
|
||||
for k, v in values.iteritems():
|
||||
self[k] = v
|
||||
|
||||
|
@ -209,11 +209,11 @@ class DesignateObject(DictObjectMixin):
|
|||
return hasattr(self, get_attrname(name))
|
||||
|
||||
def obj_what_changed(self):
|
||||
""" Returns a set of fields that have been modified. """
|
||||
"""Returns a set of fields that have been modified."""
|
||||
return set(self._obj_changes)
|
||||
|
||||
def obj_get_changes(self):
|
||||
""" Returns a dict of changed fields and their new values. """
|
||||
"""Returns a dict of changed fields and their new values."""
|
||||
changes = {}
|
||||
|
||||
for key in self.obj_what_changed():
|
||||
|
@ -222,7 +222,7 @@ class DesignateObject(DictObjectMixin):
|
|||
return changes
|
||||
|
||||
def obj_reset_changes(self, fields=None):
|
||||
""" Reset the list of fields that have been changed. """
|
||||
"""Reset the list of fields that have been changed."""
|
||||
if fields:
|
||||
self._obj_changes -= set(fields)
|
||||
for field in fields:
|
||||
|
@ -233,7 +233,7 @@ class DesignateObject(DictObjectMixin):
|
|||
self._obj_original_values = dict()
|
||||
|
||||
def obj_get_original_value(self, field):
|
||||
""" Returns the original value of a field. """
|
||||
"""Returns the original value of a field."""
|
||||
if field in self._obj_original_values.keys():
|
||||
return self._obj_original_values[field]
|
||||
elif self.obj_attr_is_set(field):
|
||||
|
|
|
@ -64,7 +64,7 @@ class DriverPlugin(Plugin):
|
|||
|
||||
@classmethod
|
||||
def get_driver(cls, name):
|
||||
""" Load a single driver """
|
||||
"""Load a single driver"""
|
||||
|
||||
LOG.debug('Looking for driver %s in %s' % (name, cls.__plugin_ns__))
|
||||
|
||||
|
@ -83,7 +83,7 @@ class ExtensionPlugin(Plugin):
|
|||
|
||||
@classmethod
|
||||
def get_extensions(cls, enabled_extensions=None):
|
||||
""" Load a series of extensions """
|
||||
"""Load a series of extensions"""
|
||||
|
||||
LOG.debug('Looking for extensions in %s' % cls.__plugin_ns__)
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ from designate.plugin import DriverPlugin
|
|||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class Quota(DriverPlugin):
|
||||
""" Base class for quota plugins """
|
||||
"""Base class for quota plugins"""
|
||||
__plugin_ns__ = 'designate.quota'
|
||||
__plugin_type__ = 'quota'
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class Service(service.Service):
|
|||
self.subscribers = self._get_subscribers()
|
||||
|
||||
def _init_extensions(self):
|
||||
""" Loads and prepares all enabled extensions """
|
||||
"""Loads and prepares all enabled extensions"""
|
||||
|
||||
enabled_notification_handlers = \
|
||||
cfg.CONF['service:sink'].enabled_notification_handlers
|
||||
|
|
|
@ -26,7 +26,7 @@ from designate import exceptions
|
|||
class Base(models.ModelBase):
|
||||
# TODO(ekarlso): Remove me when o.db patch lands for this.
|
||||
def save(self, session):
|
||||
""" Save this object """
|
||||
"""Save this object"""
|
||||
session.add(self)
|
||||
|
||||
try:
|
||||
|
@ -47,7 +47,7 @@ class SoftDeleteMixin(object):
|
|||
deleted_at = Column(DateTime, nullable=True, default=None)
|
||||
|
||||
def soft_delete(self, session):
|
||||
""" Mark this object as deleted. """
|
||||
"""Mark this object as deleted."""
|
||||
self.deleted = self.id.replace('-', '')
|
||||
self.deleted_at = timeutils.utcnow()
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ LOG = logging.getLogger(__name__)
|
|||
|
||||
|
||||
def get_storage(storage_driver):
|
||||
""" Return the engine class from the provided engine name """
|
||||
"""Return the engine class from the provided engine name"""
|
||||
cls = Storage.get_driver(storage_driver)
|
||||
|
||||
return cls()
|
||||
|
|
|
@ -23,7 +23,7 @@ from designate.plugin import DriverPlugin
|
|||
@six.add_metaclass(abc.ABCMeta)
|
||||
class Storage(DriverPlugin):
|
||||
|
||||
""" Base class for storage plugins """
|
||||
"""Base class for storage plugins"""
|
||||
__plugin_ns__ = 'designate.storage'
|
||||
__plugin_type__ = 'storage'
|
||||
|
||||
|
@ -566,7 +566,7 @@ class Storage(DriverPlugin):
|
|||
"""
|
||||
|
||||
def ping(self, context):
|
||||
""" Ping the Storage connection """
|
||||
"""Ping the Storage connection"""
|
||||
return {
|
||||
'status': None
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ cfg.CONF.register_opts(options.database_opts, group='storage:sqlalchemy')
|
|||
|
||||
|
||||
def _set_object_from_model(obj, model):
|
||||
""" Update a DesignateObject with the values from a SQLA Model """
|
||||
"""Update a DesignateObject with the values from a SQLA Model"""
|
||||
|
||||
for fieldname in obj.FIELDS:
|
||||
if hasattr(model, fieldname):
|
||||
|
@ -53,7 +53,7 @@ def _set_object_from_model(obj, model):
|
|||
|
||||
|
||||
class SQLAlchemyStorage(base.Storage):
|
||||
""" SQLAlchemy connection """
|
||||
"""SQLAlchemy connection"""
|
||||
__plugin_name__ = 'sqlalchemy'
|
||||
|
||||
def __init__(self):
|
||||
|
@ -72,11 +72,11 @@ class SQLAlchemyStorage(base.Storage):
|
|||
self.session.rollback()
|
||||
|
||||
def setup_schema(self):
|
||||
""" Semi-Private Method to create the database schema """
|
||||
"""Semi-Private Method to create the database schema"""
|
||||
models.Base.metadata.create_all(self.session.bind)
|
||||
|
||||
def teardown_schema(self):
|
||||
""" Semi-Private Method to reset the database schema """
|
||||
"""Semi-Private Method to reset the database schema"""
|
||||
models.Base.metadata.drop_all(self.session.bind)
|
||||
|
||||
def _apply_criterion(self, model, query, criterion):
|
||||
|
|
|
@ -19,7 +19,7 @@ from designate.openstack.deprecated import wsgi
|
|||
class Middleware(wsgi.Middleware):
|
||||
@classmethod
|
||||
def factory(cls, global_config, **local_conf):
|
||||
""" Used for paste app factories in paste.deploy config files """
|
||||
"""Used for paste app factories in paste.deploy config files"""
|
||||
|
||||
def _factory(app):
|
||||
return cls(app, **local_conf)
|
||||
|
|
3
tox.ini
3
tox.ini
|
@ -33,7 +33,6 @@ commands = {posargs}
|
|||
# H104 file contains nothing more than comments
|
||||
# H302 import only modules
|
||||
# H306 imports not in alphabetical order
|
||||
# H401 docstring should not start with a space
|
||||
# H402 one line docstring needs punctuation
|
||||
# H404 multi line docstring should start with a summary
|
||||
# H405 multi line docstring summary not separated with an empty line
|
||||
|
@ -41,7 +40,7 @@ commands = {posargs}
|
|||
# E126 continuation line over-indented for hanging indent
|
||||
# E128 continuation line under-indented for visual indent
|
||||
|
||||
ignore = H104,H302,H306,H401,H402,H404,H405,H904,E126,E128
|
||||
ignore = H104,H302,H306,H402,H404,H405,H904,E126,E128
|
||||
builtins = _
|
||||
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*openstack/deprecated*,*lib/python*,*egg,build,tools
|
||||
|
||||
|
|
Loading…
Reference in New Issue