Remove translation of log messages

* Removed all log translation.
* Always lazy-load logging.
* Fixed broken log lines and updated tests.

Logs should no longer be translated (starting with Pike)[1].

Also, according to OpenStack Guideline[2], logged string message should be
interpolated by the logger.

[1]: http://lists.openstack.org/pipermail/openstack-dev/2017-March/thread.html#113365
[2]: https://docs.openstack.org/oslo.i18n/latest/user/guidelines.html#adding-variables-to-log-messages

Change-Id: I07825694f173a8bebd7d62ade089c38d3c666283
parent 9a89306b
......@@ -22,10 +22,6 @@ import logging
import dns.zone
from designate.i18n import _LI
from designate.i18n import _LE
logging.basicConfig()
LOG = logging.getLogger(__name__)
......@@ -170,14 +166,14 @@ class Extractor:
zone_object = dns.zone.from_file(zonefile,
allow_include=True)
except dns.zone.UnknownOrigin:
LOG.info(_LI('%(zonefile)s is missing $ORIGIN, '
'inserting %(name)s'),
LOG.info('%(zonefile)s is missing $ORIGIN, '
'inserting %(name)s',
{'zonefile': zonefile, 'name': name})
zone_object = dns.zone.from_file(zonefile,
allow_include=True,
origin=name)
except dns.zone.NoSOA:
LOG.error(_LE('%s has no SOA') % zonefile)
LOG.error('%s has no SOA', zonefile)
zones.append(Zone(zone_object))
return zones
......
......@@ -36,9 +36,6 @@ from oslo_log import log as logging
from designate import utils
from designate import dnsutils
from designate.backend import agent_backend
from designate.i18n import _LW
from designate.i18n import _LE
from designate.i18n import _LI
import designate.backend.private_codes as pcodes
LOG = logging.getLogger(__name__)
......@@ -53,8 +50,7 @@ class RequestHandler(object):
master = {'host': raw_server[0], 'port': int(raw_server[1])}
self.masters.append(master)
LOG.info(_LI("Agent masters: %(masters)s"),
{'masters': self.masters})
LOG.info("Agent masters: %(masters)s", {'masters': self.masters})
self.allow_notify = CONF['service:agent'].allow_notify
self.transfer_source = CONF['service:agent'].transfer_source
......@@ -120,7 +116,7 @@ class RequestHandler(object):
# Does this warrant a warning?
# There is a race condition between checking if the zone exists
# and creating it.
LOG.warning(_LW("Not creating %(name)s, zone already exists"),
LOG.warning("Not creating %(name)s, zone already exists",
{'name': zone_name})
# Provide an authoritative answer
response.flags |= dns.flags.AA
......@@ -137,7 +133,7 @@ class RequestHandler(object):
except Exception as e:
# TODO(Federico) unknown exceptions should be logged with a full
# traceback. Same in the other methods.
LOG.error(_LE("Exception while creating zone %r"), e)
LOG.error("Exception while creating zone %r", e)
response.set_rcode(dns.rcode.from_text("SERVFAIL"))
return response
......@@ -168,8 +164,8 @@ class RequestHandler(object):
serial = self.backend.find_zone_serial(zone_name)
if serial is None:
LOG.warning(_LW("Refusing NOTIFY for %(name)s, doesn't exist") %
{'name': zone_name})
LOG.warning("Refusing NOTIFY for %(name)s, doesn't exist",
{'name': zone_name})
response.set_rcode(dns.rcode.from_text("REFUSED"))
return response
......@@ -219,8 +215,8 @@ class RequestHandler(object):
serial = self.backend.find_zone_serial(zone_name)
if serial is None:
LOG.warning(_LW("Not deleting %(name)s, zone doesn't exist") %
{'name': zone_name})
LOG.warning("Not deleting %(name)s, zone doesn't exist",
{'name': zone_name})
# Provide an authoritative answer
response.flags |= dns.flags.AA
return response
......@@ -246,8 +242,8 @@ class RequestHandler(object):
return True
if requester not in self.allow_notify:
LOG.warning(_LW("%(verb)s for %(name)s from %(server)s refused") %
{'verb': op, 'name': zone_name, 'server': requester})
LOG.warning("%(verb)s for %(name)s from %(server)s refused",
{'verb': op, 'name': zone_name, 'server': requester})
return False
return True
......@@ -16,7 +16,6 @@ from oslo_config import cfg
from oslo_log import log as logging
from stevedore import named
from designate.i18n import _LI
from designate.api.v2.controllers import errors
......@@ -39,7 +38,7 @@ class RootController(object):
for ext in self._mgr:
controller = self
path = ext.obj.get_path()
LOG.info(_LI("Registering an API extension at path %s"), path)
LOG.info("Registering an API extension at path %s", path)
for p in path.split('.')[:-1]:
if p != '':
controller = getattr(controller, p)
......
......@@ -29,10 +29,6 @@ from designate import notifications
from designate import context
from designate import objects
from designate.objects.adapters import DesignateAdapter
from designate.i18n import _LI
from designate.i18n import _LW
from designate.i18n import _LE
from designate.i18n import _LC
LOG = logging.getLogger(__name__)
......@@ -46,7 +42,7 @@ def auth_pipeline_factory(loader, global_conf, **local_conf):
"""
pipeline = local_conf[cfg.CONF['service:api'].auth_strategy]
pipeline = pipeline.split()
LOG.info(_LI('Getting auth pipeline: %s'), pipeline[:-1])
LOG.info('Getting auth pipeline: %s', pipeline[:-1])
filters = [loader.get_filter(n) for n in pipeline[:-1]]
app = loader.get_app(pipeline[-1])
filters.reverse()
......@@ -116,7 +112,7 @@ class KeystoneContextMiddleware(ContextMiddleware):
def __init__(self, application):
super(KeystoneContextMiddleware, self).__init__(application)
LOG.info(_LI('Starting designate keystonecontext middleware'))
LOG.info('Starting designate keystonecontext middleware')
def process_request(self, request):
headers = request.headers
......@@ -156,7 +152,7 @@ class NoAuthContextMiddleware(ContextMiddleware):
def __init__(self, application):
super(NoAuthContextMiddleware, self).__init__(application)
LOG.info(_LI('Starting designate noauthcontext middleware'))
LOG.info('Starting designate noauthcontext middleware')
def process_request(self, request):
headers = request.headers
......@@ -174,8 +170,8 @@ class TestContextMiddleware(ContextMiddleware):
def __init__(self, application, tenant_id=None, user_id=None):
super(TestContextMiddleware, self).__init__(application)
LOG.critical(_LC('Starting designate testcontext middleware'))
LOG.critical(_LC('**** DO NOT USE IN PRODUCTION ****'))
LOG.critical('Starting designate testcontext middleware')
LOG.critical('**** DO NOT USE IN PRODUCTION ****')
self.default_tenant_id = tenant_id
self.default_user_id = user_id
......@@ -197,7 +193,7 @@ class MaintenanceMiddleware(base.Middleware):
def __init__(self, application):
super(MaintenanceMiddleware, self).__init__(application)
LOG.info(_LI('Starting designate maintenance middleware'))
LOG.info('Starting designate maintenance middleware')
self.enabled = cfg.CONF['service:api'].maintenance_mode
self.role = cfg.CONF['service:api'].maintenance_mode_role
......@@ -211,7 +207,7 @@ class MaintenanceMiddleware(base.Middleware):
# If the caller has the bypass role, let them through
if ('context' in request.environ
and self.role in request.environ['context'].roles):
LOG.warning(_LW('Request authorized to bypass maintenance mode'))
LOG.warning('Request authorized to bypass maintenance mode')
return None
# Otherwise, reject the request with a 503 Service Unavailable
......@@ -231,7 +227,7 @@ class FaultWrapperMiddleware(base.Middleware):
def __init__(self, application):
super(FaultWrapperMiddleware, self).__init__(application)
LOG.info(_LI('Starting designate faultwrapper middleware'))
LOG.info('Starting designate faultwrapper middleware')
@webob.dec.wsgify
def __call__(self, request):
......@@ -302,7 +298,7 @@ class FaultWrapperMiddleware(base.Middleware):
else:
# TODO(ekarlso): Remove after verifying that there's actually a
# context always set
LOG.error(_LE('Missing context in request, please check.'))
LOG.error('Missing context in request, please check.')
return flask.Response(status=status, headers=headers,
response=json.dumps(response))
......@@ -313,7 +309,7 @@ class ValidationErrorMiddleware(base.Middleware):
def __init__(self, application):
super(ValidationErrorMiddleware, self).__init__(application)
LOG.info(_LI('Starting designate validation middleware'))
LOG.info('Starting designate validation middleware')
@webob.dec.wsgify
def __call__(self, request):
......@@ -353,7 +349,7 @@ class ValidationErrorMiddleware(base.Middleware):
else:
# TODO(ekarlso): Remove after verifying that there's actually a
# context always set
LOG.error(_LE('Missing context in request, please check.'))
LOG.error('Missing context in request, please check.')
return flask.Response(status=exception.error_code, headers=headers,
response=json.dumps(response))
......@@ -377,7 +373,7 @@ class SSLMiddleware(base.Middleware):
@removals.remove
def __init__(self, application):
super(SSLMiddleware, self).__init__(application)
LOG.info(_LI('Starting designate ssl middleware'))
LOG.info('Starting designate ssl middleware')
self.secure_proxy_ssl_header = 'HTTP_{0}'.format(
cfg.CONF['service:api'].secure_proxy_ssl_header.upper().
replace('-', '_'))
......
......@@ -17,7 +17,6 @@ from oslo_config import cfg
from oslo_log import log as logging
from paste import deploy
from designate.i18n import _LI
from designate import exceptions
from designate import utils
from designate import service
......@@ -61,6 +60,6 @@ class Service(service.WSGIService, service.Service):
msg = 'Unable to determine appropriate api-paste-config file'
raise exceptions.ConfigurationError(msg)
LOG.info(_LI('Using api-paste-config found at: %s'), config_paths[0])
LOG.info('Using api-paste-config found at: %s', config_paths[0])
return deploy.loadapp("config:%s" % config_paths[0], name='osapi_dns')
......@@ -21,7 +21,6 @@ from designate import utils
from designate.api.v2.controllers import rest
from designate.objects import Blacklist
from designate.objects.adapters import DesignateAdapter
from designate.i18n import _LI
LOG = logging.getLogger(__name__)
......@@ -40,7 +39,7 @@ class BlacklistsController(rest.RestController):
blacklist = self.central_api.get_blacklist(context, blacklist_id)
LOG.info(_LI("Retrieved %(blacklist)s"), {'blacklist': blacklist})
LOG.info("Retrieved %(blacklist)s", {'blacklist': blacklist})
return DesignateAdapter.render('API_v2', blacklist, request=request)
......@@ -62,7 +61,7 @@ class BlacklistsController(rest.RestController):
blacklists = self.central_api.find_blacklists(
context, criterion, marker, limit, sort_key, sort_dir)
LOG.info(_LI("Retrieved %(blacklists)s"), {'blacklists': blacklists})
LOG.info("Retrieved %(blacklists)s", {'blacklists': blacklists})
return DesignateAdapter.render('API_v2', blacklists, request=request)
......@@ -82,7 +81,7 @@ class BlacklistsController(rest.RestController):
blacklist = self.central_api.create_blacklist(
context, blacklist)
LOG.info(_LI("Created %(blacklist)s"), {'blacklist': blacklist})
LOG.info("Created %(blacklist)s", {'blacklist': blacklist})
response.status_int = 201
......@@ -116,7 +115,7 @@ class BlacklistsController(rest.RestController):
blacklist = self.central_api.update_blacklist(context, blacklist)
LOG.info(_LI("Updated %(blacklist)s"), {'blacklist': blacklist})
LOG.info("Updated %(blacklist)s", {'blacklist': blacklist})
response.status_int = 200
......@@ -132,7 +131,7 @@ class BlacklistsController(rest.RestController):
blacklist = self.central_api.delete_blacklist(context, blacklist_id)
LOG.info(_LI("Deleted %(blacklist)s"), {'blacklist': blacklist})
LOG.info("Deleted %(blacklist)s", {'blacklist': blacklist})
response.status_int = 204
......
......@@ -22,7 +22,6 @@ from designate import exceptions
from designate import objects
from designate.objects.adapters import DesignateAdapter
from designate.api.v2.controllers import rest
from designate.i18n import _LI
LOG = logging.getLogger(__name__)
......@@ -52,7 +51,7 @@ class FloatingIPController(rest.RestController):
fips = self.central_api.list_floatingips(context)
LOG.info(_LI("Retrieved %(fips)s"), {'fips': fips})
LOG.info("Retrieved %(fips)s", {'fips': fips})
return DesignateAdapter.render('API_v2', fips, request=request)
......@@ -80,7 +79,7 @@ class FloatingIPController(rest.RestController):
fip.validate()
LOG.info(_LI("Updated %(fip)s"), {'fip': fip})
LOG.info("Updated %(fip)s", {'fip': fip})
fip = self.central_api.update_floatingip(context, region, id_, fip)
......@@ -101,6 +100,6 @@ class FloatingIPController(rest.RestController):
fip = self.central_api.get_floatingip(context, region, id_)
LOG.info(_LI("Retrieved %(fip)s"), {'fip': fip})
LOG.info("Retrieved %(fip)s", {'fip': fip})
return DesignateAdapter.render('API_v2', fip, request=request)
......@@ -16,11 +16,9 @@ import pecan
from oslo_log import log as logging
from designate import utils
from designate.i18n import _LW
from designate.api.v2.controllers import rest
from designate.objects import Pool
from designate.objects.adapters import DesignateAdapter
from designate.i18n import _LI
LOG = logging.getLogger(__name__)
......@@ -38,7 +36,7 @@ class PoolsController(rest.RestController):
pool = self.central_api.get_pool(context, pool_id)
LOG.info(_LI("Retrieved %(pool)s"), {'pool': pool})
LOG.info("Retrieved %(pool)s", {'pool': pool})
return DesignateAdapter.render('API_v2', pool, request=request)
......@@ -60,7 +58,7 @@ class PoolsController(rest.RestController):
pools = self.central_api.find_pools(
context, criterion, marker, limit, sort_key, sort_dir)
LOG.info(_LI("Retrieved %(pools)s"), {'pools': pools})
LOG.info("Retrieved %(pools)s", {'pools': pools})
return DesignateAdapter.render('API_v2', pools, request=request)
......@@ -68,9 +66,9 @@ class PoolsController(rest.RestController):
def post_all(self):
"""Create a Pool"""
LOG.warning(_LW("Use of this API Method is DEPRECATED. This will have "
"unforeseen side affects when used with the "
"designate-manage pool commands"))
LOG.warning("Use of this API Method is DEPRECATED. This will have "
"unforeseen side affects when used with the "
"designate-manage pool commands")
request = pecan.request
response = pecan.response
......@@ -84,7 +82,7 @@ class PoolsController(rest.RestController):
# Create the pool
pool = self.central_api.create_pool(context, pool)
LOG.info(_LI("Created %(pool)s"), {'pool': pool})
LOG.info("Created %(pool)s", {'pool': pool})
pool = DesignateAdapter.render('API_v2', pool, request=request)
response.status_int = 201
......@@ -100,9 +98,9 @@ class PoolsController(rest.RestController):
def patch_one(self, pool_id):
"""Update the specific pool"""
LOG.warning(_LW("Use of this API Method is DEPRECATED. This will have "
"unforeseen side affects when used with the "
"designate-manage pool commands"))
LOG.warning("Use of this API Method is DEPRECATED. This will have "
"unforeseen side affects when used with the "
"designate-manage pool commands")
request = pecan.request
context = request.environ['context']
......@@ -121,7 +119,7 @@ class PoolsController(rest.RestController):
pool = self.central_api.update_pool(context, pool)
LOG.info(_LI("Updated %(pool)s"), {'pool': pool})
LOG.info("Updated %(pool)s", {'pool': pool})
response.status_int = 202
......@@ -132,9 +130,9 @@ class PoolsController(rest.RestController):
def delete_one(self, pool_id):
"""Delete the specific pool"""
LOG.warning(_LW("Use of this API Method is DEPRECATED. This will have "
"unforeseen side affects when used with the "
"designate-manage pool commands"))
LOG.warning("Use of this API Method is DEPRECATED. This will have "
"unforeseen side affects when used with the "
"designate-manage pool commands")
request = pecan.request
response = pecan.response
......@@ -142,7 +140,7 @@ class PoolsController(rest.RestController):
pool = self.central_api.delete_pool(context, pool_id)
LOG.info(_LI("Deleted %(pool)s"), {'pool': pool})
LOG.info("Deleted %(pool)s", {'pool': pool})
response.status_int = 204
......
......@@ -20,7 +20,6 @@ from designate import utils
from designate.api.v2.controllers import common
from designate.api.v2.controllers import rest
from designate.objects.adapters import DesignateAdapter
from designate.i18n import _LI
LOG = logging.getLogger(__name__)
......@@ -38,7 +37,7 @@ class RecordSetsViewController(rest.RestController):
rrset = self.central_api.get_recordset(context, None, recordset_id)
LOG.info(_LI("Retrieved %(recordset)s"), {'recordset': rrset})
LOG.info("Retrieved %(recordset)s", {'recordset': rrset})
canonical_loc = common.get_rrset_canonical_location(request,
rrset.zone_id,
......@@ -53,6 +52,6 @@ class RecordSetsViewController(rest.RestController):
recordsets = common.retrieve_matched_rrsets(context, self, None,
**params)
LOG.info(_LI("Retrieved %(recordsets)s"), {'recordsets': recordsets})
LOG.info("Retrieved %(recordsets)s", {'recordsets': recordsets})
return DesignateAdapter.render('API_v2', recordsets, request=request)
......@@ -33,7 +33,6 @@ import pecan.routing
from designate import exceptions
from designate.central import rpcapi as central_rpcapi
from designate.pool_manager import rpcapi as pool_mgr_rpcapi
from designate.i18n import _
class RestController(pecan.rest.RestController):
......
......@@ -19,8 +19,6 @@ from designate import utils
from designate.api.v2.controllers import rest
from designate.objects import Tld
from designate.objects.adapters import DesignateAdapter
from designate.i18n import _LI
LOG = logging.getLogger(__name__)
......@@ -38,7 +36,7 @@ class TldsController(rest.RestController):
tld = self.central_api.get_tld(context, tld_id)
LOG.info(_LI("Retrieved %(tld)s"), {'tld': tld})
LOG.info("Retrieved %(tld)s", {'tld': tld})
return DesignateAdapter.render('API_v2', tld, request=request)
......@@ -60,7 +58,7 @@ class TldsController(rest.RestController):
tlds = self.central_api.find_tlds(
context, criterion, marker, limit, sort_key, sort_dir)
LOG.info(_LI("Retrieved %(tlds)s"), {'tlds': tlds})
LOG.info("Retrieved %(tlds)s", {'tlds': tlds})
return DesignateAdapter.render('API_v2', tlds, request=request)
......@@ -79,7 +77,7 @@ class TldsController(rest.RestController):
# Create the tld
tld = self.central_api.create_tld(context, tld)
LOG.info(_LI("Created %(tld)s"), {'tld': tld})
LOG.info("Created %(tld)s", {'tld': tld})
response.status_int = 201
......@@ -111,7 +109,7 @@ class TldsController(rest.RestController):
tld = self.central_api.update_tld(context, tld)
LOG.info(_LI("Updated %(tld)s"), {'tld': tld})
LOG.info("Updated %(tld)s", {'tld': tld})
response.status_int = 200
......@@ -127,7 +125,7 @@ class TldsController(rest.RestController):
tld = self.central_api.delete_tld(context, tld_id)
LOG.info(_LI("Deleted %(tld)s"), {'tld': tld})
LOG.info("Deleted %(tld)s", {'tld': tld})
response.status_int = 204
......
......@@ -21,8 +21,6 @@ from designate import utils
from designate.api.v2.controllers import rest
from designate.objects import TsigKey
from designate.objects.adapters import DesignateAdapter
from designate.i18n import _LI
LOG = logging.getLogger(__name__)
......@@ -40,7 +38,7 @@ class TsigKeysController(rest.RestController):
tsigkey = self.central_api.get_tsigkey(context, tsigkey_id)
LOG.info(_LI("Retrieved %(tsigkey)s"), {'tsigkey': tsigkey})
LOG.info("Retrieved %(tsigkey)s", {'tsigkey': tsigkey})
return DesignateAdapter.render('API_v2', tsigkey, request=request)
......@@ -62,7 +60,7 @@ class TsigKeysController(rest.RestController):
tsigkeys = self.central_api.find_tsigkeys(
context, criterion, marker, limit, sort_key, sort_dir)
LOG.info(_LI("Retrieved %(tsigkeys)s"), {'tsigkeys': tsigkeys})
LOG.info("Retrieved %(tsigkeys)s", {'tsigkeys': tsigkeys})
return DesignateAdapter.render('API_v2', tsigkeys, request=request)
......@@ -82,7 +80,7 @@ class TsigKeysController(rest.RestController):
tsigkey = self.central_api.create_tsigkey(
context, tsigkey)
LOG.info(_LI("Created %(tsigkey)s"), {'tsigkey': tsigkey})
LOG.info("Created %(tsigkey)s", {'tsigkey': tsigkey})
tsigkey = DesignateAdapter.render('API_v2', tsigkey, request=request)
......@@ -115,7 +113,7 @@ class TsigKeysController(rest.RestController):
# Update and persist the resource
tsigkey = self.central_api.update_tsigkey(context, tsigkey)
LOG.info(_LI("Updated %(tsigkey)s"), {'tsigkey': tsigkey})
LOG.info("Updated %(tsigkey)s", {'tsigkey': tsigkey})
response.status_int = 200
......@@ -131,7 +129,7 @@ class TsigKeysController(rest.RestController):
tsigkey = self.central_api.delete_tsigkey(context, tsigkey_id)
LOG.info(_LI("Deleted %(tsigkey)s"), {'tsigkey': tsigkey})
LOG.info("Deleted %(tsigkey)s", {'tsigkey': tsigkey})
response.status_int = 204
......
......@@ -25,8 +25,6 @@ from designate.api.v2.controllers.zones import tasks
from designate.api.v2.controllers.zones import nameservers
from designate import objects
from designate.objects.adapters import DesignateAdapter
from designate.i18n import _LI
CONF = cfg.CONF
......@@ -54,7 +52,7 @@ class ZonesController(rest.RestController):
zone = self.central_api.get_zone(context, zone_id)
LOG.info(_LI("Retrieved %(zone)s"), {'zone': zone})
LOG.info("Retrieved %(zone)s", {'zone': zone})
return DesignateAdapter.render(
'API_v2',
......@@ -80,7 +78,7 @@ class ZonesController(rest.RestController):
zones = self.central_api.find_zones(
context, criterion, marker, limit, sort_key, sort_dir)
LOG.info(_LI("Retrieved %(zones)s"), {'zones': zones})
LOG.info("Retrieved %(zones)s", {'zones': zones})
return DesignateAdapter.render('API_v2', zones, request=request)
......@@ -107,7 +105,7 @@ class ZonesController(rest.RestController):
# Create the zone
zone = self.central_api.create_zone(context, zone)
LOG.info(_LI("Created %(zone)s"), {'zone': zone})
LOG.info("Created %(zone)s", {'zone': zone})
# Prepare the response headers
# If the zone has been created asynchronously
......@@ -178,7 +176,7 @@ class ZonesController(rest.RestController):
zone = self.central_api.update_zone(
context, zone, increment_serial=increment_serial)
LOG.info(_LI("Updated %(zone)s"), {'zone': zone})
LOG.info("Updated %(zone)s", {'zone': zone})
if zone.status == 'PENDING':
response.status_int = 202
......@@ -198,6 +196,6 @@ class ZonesController(rest.RestController):
zone = self.central_api.delete_zone(context, zone_id)
response.status_int = 202
LOG.info(_LI("Deleted %(zone)s"), {'zone': zone})
LOG.info("Deleted %(zone)s", {'zone': zone})
return DesignateAdapter.render('API_v2', zone, request=request)
......@@ -18,8 +18,6 @@ from oslo_log import log as logging
from designate.api.v2.controllers import rest
from designate.objects.adapters import DesignateAdapter
from designate.i18n import _LI
LOG = logging.getLogger(__name__)
......@@ -37,7 +35,7 @@ class NameServersController(rest.RestController):
ns_records = self.central_api.get_zone_ns_records(context, zone_id)
LOG.info(_LI("Created %(ns_records)s"), {'ns_records': ns_records})
LOG.info("Created %(ns_records)s", {'ns_records': ns_records})
return {
"nameservers": DesignateAdapter.render(
......
......@@ -17,8 +17,6 @@ from oslo_log import log as logging
from designate import utils
from designate.api.v2.controllers import rest
from designate.i18n import _LI
LOG = logging.getLogger(__name__)
......@@ -40,7 +38,7 @@ class AbandonController(rest.RestController):
zone = self.central_api.delete_zone(context, zone_id)
if zone.deleted_at:
response.status_int = 204
LOG.info(_LI("Abandoned %(zone)s"), {'zone': zone})
LOG.info("Abandoned %(zone)s", {'zone': zone})
else:
response.status_int = 500
......
......@@ -21,8 +21,6 @@ from designate import policy
from designate import utils
from designate.api.v2.controllers import rest
from designate.objects.adapters import DesignateAdapter
from designate.i18n import _LI
LOG = logging.getLogger(__name__)
......@@ -61,7 +59,7 @@ class ZoneExportCreateController(rest.RestController):
context, zone_id)
response.status_int = 202
LOG.info(_LI("Created %(zone_export)s"), {'zone_export': zone_export})
LOG.info("Created %(zone_export)s", {'zone_export': zone_export})
zone_export = DesignateAdapter.render(
'API_v2', zone_export, request=request)
......@@ -86,7 +84,7 @@ class ZoneExportsController(rest.RestController):
zone_export = self.central_api.get_zone_export(context, export_id)
LOG.info(_LI("Retrieved %(export)s"), {'export': zone_export})
LOG.info("Retrieved %(export)s", {'export': zone_export})
return DesignateAdapter.render(
'API_v2',
......@@ -110,7 +108,7 @@ class ZoneExportsController(rest.RestController):
zone_exports = self.central_api.find_zone_exports(
context, criterion, marker, limit, sort_key, sort_dir)
LOG.info(_LI("Retrieved %(exports)s"),
LOG.info("Retrieved %(exports)s",
{'exports': zone_exports})
return DesignateAdapter.render(
......@@ -131,7 +129,7 @@ class ZoneExportsController(rest.RestController):
zone_export = self.central_api.delete_zone_export(
context, zone_export_id)
LOG.info(_LI("Deleted %(zone_export)s"), {'zone_export': zone_export})