common: Stop translating log messages
Change-Id: I128a64c6126014774bf6218502e6bfdea63b783f Partial-Bug: #1674543
This commit is contained in:
@@ -96,7 +96,7 @@ class DatabaseAuditor(Daemon):
|
|||||||
time.sleep(random() * self.interval)
|
time.sleep(random() * self.interval)
|
||||||
while True:
|
while True:
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
'Begin {} audit pass.'.format(self.server_type))
|
'Begin %s audit pass.', self.server_type)
|
||||||
begin = time.time()
|
begin = time.time()
|
||||||
try:
|
try:
|
||||||
reported = self._one_audit_pass(reported)
|
reported = self._one_audit_pass(reported)
|
||||||
@@ -116,7 +116,7 @@ class DatabaseAuditor(Daemon):
|
|||||||
def run_once(self, *args, **kwargs):
|
def run_once(self, *args, **kwargs):
|
||||||
"""Run the database audit once."""
|
"""Run the database audit once."""
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
'Begin {} audit "once" mode'.format(self.server_type))
|
'Begin %s audit "once" mode', self.server_type)
|
||||||
begin = reported = time.time()
|
begin = reported = time.time()
|
||||||
self._one_audit_pass(reported)
|
self._one_audit_pass(reported)
|
||||||
elapsed = time.time() - begin
|
elapsed = time.time() - begin
|
||||||
|
@@ -13,8 +13,6 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from swift import gettext_ as _
|
|
||||||
|
|
||||||
from swift.common.swob import Request, HTTPServerError
|
from swift.common.swob import Request, HTTPServerError
|
||||||
from swift.common.utils import get_logger, generate_trans_id, close_if_possible
|
from swift.common.utils import get_logger, generate_trans_id, close_if_possible
|
||||||
from swift.common.wsgi import WSGIContext
|
from swift.common.wsgi import WSGIContext
|
||||||
@@ -74,7 +72,7 @@ class CatchErrorsContext(WSGIContext):
|
|||||||
# catch any errors in the pipeline
|
# catch any errors in the pipeline
|
||||||
resp = self._app_call(env)
|
resp = self._app_call(env)
|
||||||
except: # noqa
|
except: # noqa
|
||||||
self.logger.exception(_('Error: An error occurred'))
|
self.logger.exception('Error: An error occurred')
|
||||||
resp = HTTPServerError(request=Request(env),
|
resp = HTTPServerError(request=Request(env),
|
||||||
body=b'An error occurred',
|
body=b'An error occurred',
|
||||||
content_type='text/plain')
|
content_type='text/plain')
|
||||||
|
@@ -29,8 +29,6 @@ rewritten and the request is passed further down the WSGI chain.
|
|||||||
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from swift import gettext_ as _
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import dns.resolver
|
import dns.resolver
|
||||||
import dns.exception
|
import dns.exception
|
||||||
@@ -167,7 +165,7 @@ class CNAMELookupMiddleware(object):
|
|||||||
elif self._domain_endswith_in_storage_domain(found_domain):
|
elif self._domain_endswith_in_storage_domain(found_domain):
|
||||||
# Found it!
|
# Found it!
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
_('Mapped %(given_domain)s to %(found_domain)s') %
|
'Mapped %(given_domain)s to %(found_domain)s',
|
||||||
{'given_domain': given_domain,
|
{'given_domain': given_domain,
|
||||||
'found_domain': found_domain})
|
'found_domain': found_domain})
|
||||||
if port:
|
if port:
|
||||||
@@ -180,8 +178,8 @@ class CNAMELookupMiddleware(object):
|
|||||||
else:
|
else:
|
||||||
# try one more deep in the chain
|
# try one more deep in the chain
|
||||||
self.logger.debug(
|
self.logger.debug(
|
||||||
_('Following CNAME chain for '
|
'Following CNAME chain for '
|
||||||
'%(given_domain)s to %(found_domain)s') %
|
'%(given_domain)s to %(found_domain)s',
|
||||||
{'given_domain': given_domain,
|
{'given_domain': given_domain,
|
||||||
'found_domain': found_domain})
|
'found_domain': found_domain})
|
||||||
a_domain = found_domain
|
a_domain = found_domain
|
||||||
|
@@ -22,7 +22,6 @@ from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
|||||||
import six
|
import six
|
||||||
from six.moves.urllib import parse as urlparse
|
from six.moves.urllib import parse as urlparse
|
||||||
|
|
||||||
from swift import gettext_ as _
|
|
||||||
from swift.common.exceptions import EncryptionException, UnknownSecretIdError
|
from swift.common.exceptions import EncryptionException, UnknownSecretIdError
|
||||||
from swift.common.swob import HTTPInternalServerError
|
from swift.common.swob import HTTPInternalServerError
|
||||||
from swift.common.utils import get_logger
|
from swift.common.utils import get_logger
|
||||||
@@ -160,7 +159,7 @@ class CryptoWSGIContext(WSGIContext):
|
|||||||
try:
|
try:
|
||||||
fetch_crypto_keys = env[CRYPTO_KEY_CALLBACK]
|
fetch_crypto_keys = env[CRYPTO_KEY_CALLBACK]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
self.logger.exception(_('ERROR get_keys() missing callback'))
|
self.logger.exception('ERROR get_keys() missing callback')
|
||||||
raise HTTPInternalServerError(
|
raise HTTPInternalServerError(
|
||||||
"Unable to retrieve encryption keys.")
|
"Unable to retrieve encryption keys.")
|
||||||
|
|
||||||
@@ -181,12 +180,12 @@ class CryptoWSGIContext(WSGIContext):
|
|||||||
self.crypto.check_key(key)
|
self.crypto.check_key(key)
|
||||||
continue
|
continue
|
||||||
except KeyError:
|
except KeyError:
|
||||||
self.logger.exception(_("Missing key for %r") % name)
|
self.logger.exception("Missing key for %r", name)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
self.logger.exception(_("Did not get a keys dict"))
|
self.logger.exception("Did not get a keys dict")
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
# don't include the key in any messages!
|
# don't include the key in any messages!
|
||||||
self.logger.exception(_("Bad key for %(name)r: %(err)s") %
|
self.logger.exception("Bad key for %(name)r: %(err)s",
|
||||||
{'name': name, 'err': e})
|
{'name': name, 'err': e})
|
||||||
raise HTTPInternalServerError(
|
raise HTTPInternalServerError(
|
||||||
"Unable to retrieve encryption keys.")
|
"Unable to retrieve encryption keys.")
|
||||||
|
@@ -16,7 +16,6 @@
|
|||||||
import base64
|
import base64
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from swift import gettext_ as _
|
|
||||||
from swift.common.header_key_dict import HeaderKeyDict
|
from swift.common.header_key_dict import HeaderKeyDict
|
||||||
from swift.common.http import is_success
|
from swift.common.http import is_success
|
||||||
from swift.common.middleware.crypto.crypto_utils import CryptoWSGIContext, \
|
from swift.common.middleware.crypto.crypto_utils import CryptoWSGIContext, \
|
||||||
@@ -77,10 +76,10 @@ class BaseDecrypterContext(CryptoWSGIContext):
|
|||||||
crypto_meta['body_key'])
|
crypto_meta['body_key'])
|
||||||
except KeyError as err:
|
except KeyError as err:
|
||||||
self.logger.error(
|
self.logger.error(
|
||||||
_('Error decrypting %(resp_type)s: Missing %(key)s'),
|
'Error decrypting %(resp_type)s: Missing %(key)s',
|
||||||
{'resp_type': self.server_type, 'key': err})
|
{'resp_type': self.server_type, 'key': err})
|
||||||
except ValueError as err:
|
except ValueError as err:
|
||||||
self.logger.error(_('Error decrypting %(resp_type)s: %(reason)s'),
|
self.logger.error('Error decrypting %(resp_type)s: %(reason)s',
|
||||||
{'resp_type': self.server_type, 'reason': err})
|
{'resp_type': self.server_type, 'reason': err})
|
||||||
raise HTTPInternalServerError(
|
raise HTTPInternalServerError(
|
||||||
body='Error decrypting %s' % self.server_type,
|
body='Error decrypting %s' % self.server_type,
|
||||||
@@ -178,7 +177,7 @@ class DecrypterObjContext(BaseDecrypterContext):
|
|||||||
value, key, required, bytes_to_wsgi)
|
value, key, required, bytes_to_wsgi)
|
||||||
except EncryptionException as err:
|
except EncryptionException as err:
|
||||||
self.logger.error(
|
self.logger.error(
|
||||||
_("Error decrypting header %(header)s: %(error)s"),
|
"Error decrypting header %(header)s: %(error)s",
|
||||||
{'header': header, 'error': err})
|
{'header': header, 'error': err})
|
||||||
raise HTTPInternalServerError(
|
raise HTTPInternalServerError(
|
||||||
body='Error decrypting header',
|
body='Error decrypting header',
|
||||||
@@ -313,7 +312,7 @@ class DecrypterObjContext(BaseDecrypterContext):
|
|||||||
try:
|
try:
|
||||||
crypto_meta = self.get_crypto_meta(header, check)
|
crypto_meta = self.get_crypto_meta(header, check)
|
||||||
except EncryptionException as err:
|
except EncryptionException as err:
|
||||||
self.logger.error(_('Error decrypting object: %s'), err)
|
self.logger.error('Error decrypting object: %s', err)
|
||||||
raise HTTPInternalServerError(
|
raise HTTPInternalServerError(
|
||||||
body='Error decrypting object', content_type='text/plain')
|
body='Error decrypting object', content_type='text/plain')
|
||||||
return crypto_meta
|
return crypto_meta
|
||||||
|
@@ -13,7 +13,6 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
import time
|
import time
|
||||||
from swift import gettext_ as _
|
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
|
|
||||||
@@ -261,7 +260,7 @@ class RateLimitMiddleware(object):
|
|||||||
|
|
||||||
if account_name in self.ratelimit_blacklist or \
|
if account_name in self.ratelimit_blacklist or \
|
||||||
account_global_ratelimit == 'BLACKLIST':
|
account_global_ratelimit == 'BLACKLIST':
|
||||||
self.logger.error(_('Returning 497 because of blacklisting: %s'),
|
self.logger.error('Returning 497 because of blacklisting: %s',
|
||||||
account_name)
|
account_name)
|
||||||
eventlet.sleep(self.BLACK_LIST_SLEEP)
|
eventlet.sleep(self.BLACK_LIST_SLEEP)
|
||||||
return Response(status='497 Blacklisted',
|
return Response(status='497 Blacklisted',
|
||||||
@@ -276,8 +275,8 @@ class RateLimitMiddleware(object):
|
|||||||
if self.log_sleep_time_seconds and \
|
if self.log_sleep_time_seconds and \
|
||||||
need_to_sleep > self.log_sleep_time_seconds:
|
need_to_sleep > self.log_sleep_time_seconds:
|
||||||
self.logger.warning(
|
self.logger.warning(
|
||||||
_("Ratelimit sleep log: %(sleep)s for "
|
"Ratelimit sleep log: %(sleep)s for "
|
||||||
"%(account)s/%(container)s/%(object)s"),
|
"%(account)s/%(container)s/%(object)s",
|
||||||
{'sleep': need_to_sleep, 'account': account_name,
|
{'sleep': need_to_sleep, 'account': account_name,
|
||||||
'container': container_name, 'object': obj_name})
|
'container': container_name, 'object': obj_name})
|
||||||
if need_to_sleep > 0:
|
if need_to_sleep > 0:
|
||||||
@@ -288,8 +287,8 @@ class RateLimitMiddleware(object):
|
|||||||
else:
|
else:
|
||||||
path = '/'.join((account_name, container_name))
|
path = '/'.join((account_name, container_name))
|
||||||
self.logger.error(
|
self.logger.error(
|
||||||
_('Returning 498 for %(meth)s to %(path)s. '
|
'Returning 498 for %(meth)s to %(path)s. '
|
||||||
'Ratelimit (Max Sleep) %(e)s'),
|
'Ratelimit (Max Sleep) %(e)s',
|
||||||
{'meth': req.method, 'path': path, 'e': str(e)})
|
{'meth': req.method, 'path': path, 'e': str(e)})
|
||||||
error_resp = Response(status='498 Rate Limited',
|
error_resp = Response(status='498 Rate Limited',
|
||||||
body='Slow down', request=req)
|
body='Slow down', request=req)
|
||||||
@@ -309,7 +308,7 @@ class RateLimitMiddleware(object):
|
|||||||
self.memcache_client = cache_from_env(env)
|
self.memcache_client = cache_from_env(env)
|
||||||
if not self.memcache_client:
|
if not self.memcache_client:
|
||||||
self.logger.warning(
|
self.logger.warning(
|
||||||
_('Warning: Cannot ratelimit without a memcached client'))
|
'Warning: Cannot ratelimit without a memcached client')
|
||||||
return self.app(env, start_response)
|
return self.app(env, start_response)
|
||||||
try:
|
try:
|
||||||
version, account, container, obj = req.split_path(1, 4, True)
|
version, account, container, obj = req.split_path(1, 4, True)
|
||||||
|
@@ -20,7 +20,6 @@ import time
|
|||||||
from resource import getpagesize
|
from resource import getpagesize
|
||||||
|
|
||||||
from swift import __version__ as swiftver
|
from swift import __version__ as swiftver
|
||||||
from swift import gettext_ as _
|
|
||||||
from swift.common.constraints import check_mount
|
from swift.common.constraints import check_mount
|
||||||
from swift.common.storage_policy import POLICIES
|
from swift.common.storage_policy import POLICIES
|
||||||
from swift.common.swob import Request, Response
|
from swift.common.swob import Request, Response
|
||||||
@@ -89,11 +88,11 @@ class ReconMiddleware(object):
|
|||||||
if err.errno == errno.ENOENT and ignore_missing:
|
if err.errno == errno.ENOENT and ignore_missing:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
self.logger.exception(_('Error reading recon cache file'))
|
self.logger.exception('Error reading recon cache file')
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.logger.exception(_('Error parsing recon cache file'))
|
self.logger.exception('Error parsing recon cache file')
|
||||||
except Exception:
|
except Exception:
|
||||||
self.logger.exception(_('Error retrieving recon data'))
|
self.logger.exception('Error retrieving recon data')
|
||||||
return dict((key, None) for key in cache_keys)
|
return dict((key, None) for key in cache_keys)
|
||||||
|
|
||||||
def get_version(self):
|
def get_version(self):
|
||||||
@@ -181,7 +180,7 @@ class ReconMiddleware(object):
|
|||||||
try:
|
try:
|
||||||
return {self.devices: os.listdir(self.devices)}
|
return {self.devices: os.listdir(self.devices)}
|
||||||
except Exception:
|
except Exception:
|
||||||
self.logger.exception(_('Error listing devices'))
|
self.logger.exception('Error listing devices')
|
||||||
return {self.devices: None}
|
return {self.devices: None}
|
||||||
|
|
||||||
def get_updater_info(self, recon_type):
|
def get_updater_info(self, recon_type):
|
||||||
@@ -277,7 +276,7 @@ class ReconMiddleware(object):
|
|||||||
except IOError as err:
|
except IOError as err:
|
||||||
sums[ringfile] = None
|
sums[ringfile] = None
|
||||||
if err.errno != errno.ENOENT:
|
if err.errno != errno.ENOENT:
|
||||||
self.logger.exception(_('Error reading ringfile'))
|
self.logger.exception('Error reading ringfile')
|
||||||
return sums
|
return sums
|
||||||
|
|
||||||
def get_swift_conf_md5(self):
|
def get_swift_conf_md5(self):
|
||||||
@@ -287,7 +286,7 @@ class ReconMiddleware(object):
|
|||||||
hexsum = md5_hash_for_file(SWIFT_CONF_FILE)
|
hexsum = md5_hash_for_file(SWIFT_CONF_FILE)
|
||||||
except IOError as err:
|
except IOError as err:
|
||||||
if err.errno != errno.ENOENT:
|
if err.errno != errno.ENOENT:
|
||||||
self.logger.exception(_('Error reading swift.conf'))
|
self.logger.exception('Error reading swift.conf')
|
||||||
return {SWIFT_CONF_FILE: hexsum}
|
return {SWIFT_CONF_FILE: hexsum}
|
||||||
|
|
||||||
def get_quarantine_count(self):
|
def get_quarantine_count(self):
|
||||||
|
Reference in New Issue
Block a user