Drop more translations
Partial-Bug: #1674543 Change-Id: Iad3011e8603cd2771add97942d46122434d048cd
This commit is contained in:
parent
e6792bccef
commit
d3d503f905
@ -22,7 +22,6 @@ import time
|
||||
import six
|
||||
from six.moves import configparser
|
||||
|
||||
from swift import gettext_ as _
|
||||
from swift.common.utils import get_valid_utf8_str
|
||||
|
||||
|
||||
@ -58,7 +57,7 @@ class ContainerSyncRealms(object):
|
||||
log_func = self.logger.debug
|
||||
else:
|
||||
log_func = self.logger.error
|
||||
log_func(_('Could not load %(conf)r: %(error)s') % {
|
||||
log_func('Could not load %(conf)r: %(error)s', {
|
||||
'conf': self.conf_path, 'error': err})
|
||||
else:
|
||||
if mtime != self.conf_path_mtime:
|
||||
@ -68,8 +67,8 @@ class ContainerSyncRealms(object):
|
||||
conf.read(self.conf_path)
|
||||
except configparser.ParsingError as err:
|
||||
self.logger.error(
|
||||
_('Could not load %(conf)r: %(error)s')
|
||||
% {'conf': self.conf_path, 'error': err})
|
||||
'Could not load %(conf)r: %(error)s',
|
||||
{'conf': self.conf_path, 'error': err})
|
||||
else:
|
||||
try:
|
||||
self.mtime_check_interval = conf.getfloat(
|
||||
@ -82,9 +81,9 @@ class ContainerSyncRealms(object):
|
||||
now + self.mtime_check_interval
|
||||
except (configparser.ParsingError, ValueError) as err:
|
||||
self.logger.error(
|
||||
_('Error in %(conf)r with '
|
||||
'mtime_check_interval: %(error)s')
|
||||
% {'conf': self.conf_path, 'error': err})
|
||||
'Error in %(conf)r with '
|
||||
'mtime_check_interval: %(error)s',
|
||||
{'conf': self.conf_path, 'error': err})
|
||||
realms = {}
|
||||
for section in conf.sections():
|
||||
realm = {}
|
||||
|
@ -26,7 +26,6 @@ import time
|
||||
import errno
|
||||
import six
|
||||
import six.moves.cPickle as pickle
|
||||
from swift import gettext_ as _
|
||||
from tempfile import mkstemp
|
||||
|
||||
from eventlet import sleep, Timeout
|
||||
@ -482,7 +481,7 @@ class DatabaseBroker(object):
|
||||
raise
|
||||
quar_path = "%s-%s" % (quar_path, uuid4().hex)
|
||||
renamer(self.db_dir, quar_path, fsync=False)
|
||||
detail = _('Quarantined %(db_dir)s to %(quar_path)s due to '
|
||||
detail = ('Quarantined %(db_dir)s to %(quar_path)s due to '
|
||||
'%(reason)s') % {'db_dir': self.db_dir,
|
||||
'quar_path': quar_path,
|
||||
'reason': reason}
|
||||
@ -584,7 +583,7 @@ class DatabaseBroker(object):
|
||||
self.conn = conn
|
||||
except (Exception, Timeout):
|
||||
logging.exception(
|
||||
_('Broker error trying to rollback locked connection'))
|
||||
'Broker error trying to rollback locked connection')
|
||||
conn.close()
|
||||
|
||||
def _new_db_id(self):
|
||||
@ -836,7 +835,7 @@ class DatabaseBroker(object):
|
||||
self._commit_puts_load(item_list, data)
|
||||
except Exception:
|
||||
self.logger.exception(
|
||||
_('Invalid pending entry %(file)s: %(entry)s'),
|
||||
'Invalid pending entry %(file)s: %(entry)s',
|
||||
{'file': self.pending_file, 'entry': entry})
|
||||
if item_list:
|
||||
self.merge_items(item_list)
|
||||
|
@ -23,7 +23,6 @@ import uuid
|
||||
import errno
|
||||
import re
|
||||
from contextlib import contextmanager
|
||||
from swift import gettext_ as _
|
||||
|
||||
from eventlet import GreenPool, sleep, Timeout
|
||||
from eventlet.green import subprocess
|
||||
@ -176,7 +175,7 @@ class ReplConnection(BufferedHTTPConnection):
|
||||
except (Exception, Timeout):
|
||||
self.close()
|
||||
self.logger.exception(
|
||||
_('ERROR reading HTTP response from %s'), self.node)
|
||||
'ERROR reading HTTP response from %s', self.node)
|
||||
return None
|
||||
|
||||
|
||||
@ -254,15 +253,15 @@ class Replicator(Daemon):
|
||||
"""Report the current stats to the logs."""
|
||||
now = time.time()
|
||||
self.logger.info(
|
||||
_('Attempted to replicate %(count)d dbs in %(time).5f seconds '
|
||||
'(%(rate).5f/s)'),
|
||||
'Attempted to replicate %(count)d dbs in %(time).5f seconds '
|
||||
'(%(rate).5f/s)',
|
||||
{'count': self.stats['attempted'],
|
||||
'time': now - self.stats['start'],
|
||||
'rate': self.stats['attempted'] /
|
||||
(now - self.stats['start'] + 0.0000001)})
|
||||
self.logger.info(_('Removed %(remove)d dbs') % self.stats)
|
||||
self.logger.info(_('%(success)s successes, %(failure)s failures')
|
||||
% self.stats)
|
||||
self.logger.info('Removed %(remove)d dbs', self.stats)
|
||||
self.logger.info('%(success)s successes, %(failure)s failures',
|
||||
self.stats)
|
||||
dump_recon_cache(
|
||||
{'replication_stats': self.stats,
|
||||
'replication_time': now - self.stats['start'],
|
||||
@ -308,7 +307,7 @@ class Replicator(Daemon):
|
||||
proc = subprocess.Popen(popen_args)
|
||||
proc.communicate()
|
||||
if proc.returncode != 0:
|
||||
self.logger.error(_('ERROR rsync failed with %(code)s: %(args)s'),
|
||||
self.logger.error('ERROR rsync failed with %(code)s: %(args)s',
|
||||
{'code': proc.returncode, 'args': popen_args})
|
||||
return proc.returncode == 0
|
||||
|
||||
@ -625,10 +624,10 @@ class Replicator(Daemon):
|
||||
'replicate out and remove.' % (object_file, name, bpart))
|
||||
except (Exception, Timeout) as e:
|
||||
if 'no such table' in str(e):
|
||||
self.logger.error(_('Quarantining DB %s'), object_file)
|
||||
self.logger.error('Quarantining DB %s', object_file)
|
||||
quarantine_db(broker.db_file, broker.db_type)
|
||||
else:
|
||||
self.logger.exception(_('ERROR reading db %s'), object_file)
|
||||
self.logger.exception('ERROR reading db %s', object_file)
|
||||
nodes = self.ring.get_part_nodes(int(partition))
|
||||
self._add_failure_stats([(failure_dev['replication_ip'],
|
||||
failure_dev['device'])
|
||||
@ -680,13 +679,13 @@ class Replicator(Daemon):
|
||||
repl_nodes.append(next(more_nodes))
|
||||
except StopIteration:
|
||||
self.logger.error(
|
||||
_('ERROR There are not enough handoff nodes to reach '
|
||||
'replica count for partition %s'),
|
||||
'ERROR There are not enough handoff nodes to reach '
|
||||
'replica count for partition %s',
|
||||
partition)
|
||||
self.logger.error(_('ERROR Remote drive not mounted %s'), node)
|
||||
self.logger.error('ERROR Remote drive not mounted %s', node)
|
||||
except (Exception, Timeout):
|
||||
self.logger.exception(_('ERROR syncing %(file)s with node'
|
||||
' %(node)s'),
|
||||
self.logger.exception('ERROR syncing %(file)s with node'
|
||||
' %(node)s',
|
||||
{'file': object_file, 'node': node})
|
||||
if not success:
|
||||
failure_devs_info.add((node['replication_ip'], node['device']))
|
||||
@ -785,7 +784,7 @@ class Replicator(Daemon):
|
||||
dirs = []
|
||||
ips = whataremyips(self.bind_ip)
|
||||
if not ips:
|
||||
self.logger.error(_('ERROR Failed to get my own IPs?'))
|
||||
self.logger.error('ERROR Failed to get my own IPs?')
|
||||
return
|
||||
|
||||
if self.handoffs_only or self.handoff_delete:
|
||||
@ -830,12 +829,12 @@ class Replicator(Daemon):
|
||||
self.logger.error("Can't find itself %s with port %s in ring "
|
||||
"file, not replicating",
|
||||
", ".join(ips), self.port)
|
||||
self.logger.info(_('Beginning replication run'))
|
||||
self.logger.info('Beginning replication run')
|
||||
for part, object_file, node_id in self.roundrobin_datadirs(dirs):
|
||||
self.cpool.spawn_n(
|
||||
self._replicate_object, part, object_file, node_id)
|
||||
self.cpool.waitall()
|
||||
self.logger.info(_('Replication run OVER'))
|
||||
self.logger.info('Replication run OVER')
|
||||
if self.handoffs_only or self.handoff_delete:
|
||||
self.logger.warning(
|
||||
'Finished replication pass with handoffs_only and/or '
|
||||
@ -853,7 +852,7 @@ class Replicator(Daemon):
|
||||
try:
|
||||
self.run_once()
|
||||
except (Exception, Timeout):
|
||||
self.logger.exception(_('ERROR trying to replicate'))
|
||||
self.logger.exception('ERROR trying to replicate')
|
||||
elapsed = time.time() - begin
|
||||
if elapsed < self.interval:
|
||||
sleep(self.interval - elapsed)
|
||||
@ -957,7 +956,7 @@ class ReplicatorRpc(object):
|
||||
info = self._get_synced_replication_info(broker, remote_info)
|
||||
except (Exception, Timeout) as e:
|
||||
if 'no such table' in str(e):
|
||||
self.logger.error(_("Quarantining DB %s"), broker)
|
||||
self.logger.error("Quarantining DB %s", broker)
|
||||
quarantine_db(broker.db_file, broker.db_type)
|
||||
return HTTPNotFound()
|
||||
raise
|
||||
|
@ -23,7 +23,6 @@ import time
|
||||
import subprocess
|
||||
import re
|
||||
import six
|
||||
from swift import gettext_ as _
|
||||
import tempfile
|
||||
from distutils.spawn import find_executable
|
||||
|
||||
@ -68,22 +67,22 @@ def setup_env():
|
||||
resource.setrlimit(resource.RLIMIT_NOFILE,
|
||||
(MAX_DESCRIPTORS, MAX_DESCRIPTORS))
|
||||
except ValueError:
|
||||
print(_("WARNING: Unable to modify file descriptor limit. "
|
||||
"Running as non-root?"))
|
||||
print("WARNING: Unable to modify file descriptor limit. "
|
||||
"Running as non-root?")
|
||||
|
||||
try:
|
||||
resource.setrlimit(resource.RLIMIT_DATA,
|
||||
(MAX_MEMORY, MAX_MEMORY))
|
||||
except ValueError:
|
||||
print(_("WARNING: Unable to modify memory limit. "
|
||||
"Running as non-root?"))
|
||||
print("WARNING: Unable to modify memory limit. "
|
||||
"Running as non-root?")
|
||||
|
||||
try:
|
||||
resource.setrlimit(resource.RLIMIT_NPROC,
|
||||
(MAX_PROCS, MAX_PROCS))
|
||||
except ValueError:
|
||||
print(_("WARNING: Unable to modify max process limit. "
|
||||
"Running as non-root?"))
|
||||
print("WARNING: Unable to modify max process limit. "
|
||||
"Running as non-root?")
|
||||
|
||||
# Set PYTHON_EGG_CACHE if it isn't already set
|
||||
os.environ.setdefault('PYTHON_EGG_CACHE', tempfile.gettempdir())
|
||||
@ -277,7 +276,7 @@ class Manager(object):
|
||||
try:
|
||||
status += server.interact(**kwargs)
|
||||
except KeyboardInterrupt:
|
||||
print(_('\nuser quit'))
|
||||
print('\nuser quit')
|
||||
self.stop(**kwargs)
|
||||
break
|
||||
elif kwargs.get('wait', True):
|
||||
@ -314,7 +313,7 @@ class Manager(object):
|
||||
for server in self.servers:
|
||||
signaled_pids = server.stop(**kwargs)
|
||||
if not signaled_pids:
|
||||
print(_('No %s running') % server)
|
||||
print('No %s running' % server)
|
||||
else:
|
||||
server_pids[server] = signaled_pids
|
||||
|
||||
@ -327,7 +326,7 @@ class Manager(object):
|
||||
for server, killed_pid in watch_server_pids(server_pids,
|
||||
interval=kill_wait,
|
||||
**kwargs):
|
||||
print(_("%(server)s (%(pid)s) appears to have stopped") %
|
||||
print("%(server)s (%(pid)s) appears to have stopped" %
|
||||
{'server': server, 'pid': killed_pid})
|
||||
killed_pids.add(killed_pid)
|
||||
if not killed_pids.symmetric_difference(signaled_pids):
|
||||
@ -340,13 +339,13 @@ class Manager(object):
|
||||
if not killed_pids.issuperset(pids):
|
||||
# some pids of this server were not killed
|
||||
if kill_after_timeout:
|
||||
print(_('Waited %(kill_wait)s seconds for %(server)s '
|
||||
'to die; killing') %
|
||||
print('Waited %(kill_wait)s seconds for %(server)s '
|
||||
'to die; killing' %
|
||||
{'kill_wait': kill_wait, 'server': server})
|
||||
# Send SIGKILL to all remaining pids
|
||||
for pid in set(pids.keys()) - killed_pids:
|
||||
print(_('Signal %(server)s pid: %(pid)s signal: '
|
||||
'%(signal)s') % {'server': server,
|
||||
print('Signal %(server)s pid: %(pid)s signal: '
|
||||
'%(signal)s' % {'server': server,
|
||||
'pid': pid,
|
||||
'signal': signal.SIGKILL})
|
||||
# Send SIGKILL to process group
|
||||
@ -357,8 +356,8 @@ class Manager(object):
|
||||
if e.errno != errno.ESRCH:
|
||||
raise
|
||||
else:
|
||||
print(_('Waited %(kill_wait)s seconds for %(server)s '
|
||||
'to die; giving up') %
|
||||
print('Waited %(kill_wait)s seconds for %(server)s '
|
||||
'to die; giving up' %
|
||||
{'kill_wait': kill_wait, 'server': server})
|
||||
return 1
|
||||
|
||||
@ -414,7 +413,7 @@ class Manager(object):
|
||||
for server in self.servers:
|
||||
signaled_pids = server.stop(**kwargs)
|
||||
if not signaled_pids:
|
||||
print(_('No %s running') % server)
|
||||
print('No %s running' % server)
|
||||
status += 1
|
||||
return status
|
||||
|
||||
@ -424,7 +423,7 @@ class Manager(object):
|
||||
for server in self.servers:
|
||||
signaled_pids = server.kill_child_pids(**kwargs)
|
||||
if not signaled_pids:
|
||||
print(_('No %s running') % server)
|
||||
print('No %s running' % server)
|
||||
status += 1
|
||||
return status
|
||||
|
||||
@ -584,7 +583,7 @@ class Server(object):
|
||||
|
||||
def dump_found_configs():
|
||||
if found_conf_files:
|
||||
print(_('Found configs:'))
|
||||
print('Found configs:')
|
||||
for i, conf_file in enumerate(found_conf_files):
|
||||
print(' %d) %s' % (i + 1, conf_file))
|
||||
|
||||
@ -592,18 +591,18 @@ class Server(object):
|
||||
# maybe there's a config file(s) out there, but I couldn't find it!
|
||||
if not kwargs.get('quiet'):
|
||||
if number:
|
||||
print(_('Unable to locate config number %(number)s for'
|
||||
' %(server)s') %
|
||||
print('Unable to locate config number %(number)s for'
|
||||
' %(server)s' %
|
||||
{'number': number, 'server': self.server})
|
||||
else:
|
||||
print(_('Unable to locate config for %s') % self.server)
|
||||
print('Unable to locate config for %s' % self.server)
|
||||
if kwargs.get('verbose') and not kwargs.get('quiet'):
|
||||
dump_found_configs()
|
||||
elif any(["object-expirer" in name for name in conf_files]) and \
|
||||
not kwargs.get('quiet'):
|
||||
print(_("WARNING: object-expirer.conf is deprecated. "
|
||||
print("WARNING: object-expirer.conf is deprecated. "
|
||||
"Move object-expirers' configuration into "
|
||||
"object-server.conf."))
|
||||
"object-server.conf.")
|
||||
if kwargs.get('verbose'):
|
||||
dump_found_configs()
|
||||
|
||||
@ -642,24 +641,24 @@ class Server(object):
|
||||
def _signal_pid(self, sig, pid, pid_file, verbose):
|
||||
try:
|
||||
if sig != signal.SIG_DFL:
|
||||
print(_('Signal %(server)s pid: %(pid)s signal: '
|
||||
'%(signal)s') %
|
||||
print('Signal %(server)s pid: %(pid)s signal: '
|
||||
'%(signal)s' %
|
||||
{'server': self.server, 'pid': pid, 'signal': sig})
|
||||
safe_kill(pid, sig, 'swift-%s' % self.server)
|
||||
except InvalidPidFileException:
|
||||
if verbose:
|
||||
print(_('Removing pid file %(pid_file)s with wrong pid '
|
||||
'%(pid)d') % {'pid_file': pid_file, 'pid': pid})
|
||||
print('Removing pid file %(pid_file)s with wrong pid '
|
||||
'%(pid)d' % {'pid_file': pid_file, 'pid': pid})
|
||||
remove_file(pid_file)
|
||||
return False
|
||||
except OSError as e:
|
||||
if e.errno == errno.ESRCH:
|
||||
# pid does not exist
|
||||
if verbose:
|
||||
print(_("Removing stale pid file %s") % pid_file)
|
||||
print("Removing stale pid file %s" % pid_file)
|
||||
remove_file(pid_file)
|
||||
elif e.errno == errno.EPERM:
|
||||
print(_("No permission to signal PID %d") % pid)
|
||||
print("No permission to signal PID %d" % pid)
|
||||
return False
|
||||
else:
|
||||
# process exists
|
||||
@ -676,7 +675,7 @@ class Server(object):
|
||||
pids = {}
|
||||
for pid_file, pid in self.iter_pid_files(**kwargs):
|
||||
if not pid: # Catches None and 0
|
||||
print(_('Removing pid file %s with invalid pid') % pid_file)
|
||||
print('Removing pid file %s with invalid pid' % pid_file)
|
||||
remove_file(pid_file)
|
||||
continue
|
||||
if self._signal_pid(sig, pid, pid_file, kwargs.get('verbose')):
|
||||
@ -694,7 +693,7 @@ class Server(object):
|
||||
pids = {}
|
||||
for pid_file, pid in self.iter_pid_files(**kwargs):
|
||||
if not pid: # Catches None and 0
|
||||
print(_('Removing pid file %s with invalid pid') % pid_file)
|
||||
print('Removing pid file %s with invalid pid' % pid_file)
|
||||
remove_file(pid_file)
|
||||
continue
|
||||
ps_cmd = ['ps', '--ppid', str(pid), '--no-headers', '-o', 'pid']
|
||||
@ -766,15 +765,15 @@ class Server(object):
|
||||
kwargs['quiet'] = True
|
||||
conf_files = self.conf_files(**kwargs)
|
||||
if conf_files:
|
||||
print(_("%(server)s #%(number)d not running (%(conf)s)") %
|
||||
print("%(server)s #%(number)d not running (%(conf)s)" %
|
||||
{'server': self.server, 'number': number,
|
||||
'conf': conf_files[0]})
|
||||
else:
|
||||
print(_("No %s running") % self.server)
|
||||
print("No %s running" % self.server)
|
||||
return 1
|
||||
for pid, pid_file in pids.items():
|
||||
conf_file = self.get_conf_file_name(pid_file)
|
||||
print(_("%(server)s running (%(pid)s - %(conf)s)") %
|
||||
print("%(server)s running (%(pid)s - %(conf)s)" %
|
||||
{'server': self.server, 'pid': pid, 'conf': conf_file})
|
||||
return 0
|
||||
|
||||
@ -882,16 +881,16 @@ class Server(object):
|
||||
# any unstarted instances
|
||||
if conf_file in conf_files:
|
||||
already_started = True
|
||||
print(_("%(server)s running (%(pid)s - %(conf)s)") %
|
||||
print("%(server)s running (%(pid)s - %(conf)s)" %
|
||||
{'server': self.server, 'pid': pid, 'conf': conf_file})
|
||||
elif not kwargs.get('number', 0):
|
||||
already_started = True
|
||||
print(_("%(server)s running (%(pid)s - %(pid_file)s)") %
|
||||
print("%(server)s running (%(pid)s - %(pid_file)s)" %
|
||||
{'server': self.server, 'pid': pid,
|
||||
'pid_file': pid_file})
|
||||
|
||||
if already_started:
|
||||
print(_("%s already started...") % self.server)
|
||||
print("%s already started..." % self.server)
|
||||
return {}
|
||||
|
||||
if self.server not in START_ONCE_SERVERS:
|
||||
@ -900,16 +899,16 @@ class Server(object):
|
||||
pids = {}
|
||||
for conf_file in conf_files:
|
||||
if kwargs.get('once'):
|
||||
msg = _('Running %s once') % self.server
|
||||
msg = 'Running %s once' % self.server
|
||||
else:
|
||||
msg = _('Starting %s') % self.server
|
||||
msg = 'Starting %s' % self.server
|
||||
print('%s...(%s)' % (msg, conf_file))
|
||||
try:
|
||||
pid = self.spawn(conf_file, **kwargs)
|
||||
except OSError as e:
|
||||
if e.errno == errno.ENOENT:
|
||||
# TODO(clayg): should I check if self.cmd exists earlier?
|
||||
print(_("%s does not exist") % self.cmd)
|
||||
print("%s does not exist" % self.cmd)
|
||||
break
|
||||
else:
|
||||
raise
|
||||
|
@ -27,7 +27,6 @@ import time
|
||||
import six
|
||||
from swift.common.header_key_dict import HeaderKeyDict
|
||||
|
||||
from swift import gettext_ as _
|
||||
from swift.common.constraints import AUTO_CREATE_ACCOUNT_PREFIX, \
|
||||
CONTAINER_LISTING_LIMIT
|
||||
from swift.common.storage_policy import POLICIES
|
||||
@ -202,7 +201,7 @@ def get_name_and_placement(request, minsegs=1, maxsegs=None,
|
||||
policy = POLICIES.get_by_index(policy_index)
|
||||
if not policy:
|
||||
raise HTTPServiceUnavailable(
|
||||
body=_("No policy with index %s") % policy_index,
|
||||
body="No policy with index %s" % policy_index,
|
||||
request=request, content_type='text/plain')
|
||||
results = split_and_validate_path(request, minsegs=minsegs,
|
||||
maxsegs=maxsegs,
|
||||
|
@ -85,7 +85,6 @@ from six.moves.urllib.parse import quote as _quote, unquote
|
||||
from six.moves.urllib.parse import urlparse
|
||||
from six.moves import UserList
|
||||
|
||||
from swift import gettext_ as _
|
||||
import swift.common.exceptions
|
||||
from swift.common.http import is_server_error
|
||||
from swift.common.header_key_dict import HeaderKeyDict
|
||||
@ -861,8 +860,8 @@ def fsync_dir(dirpath):
|
||||
if err.errno == errno.ENOTDIR:
|
||||
# Raise error if someone calls fsync_dir on a non-directory
|
||||
raise
|
||||
logging.warning(_('Unable to perform fsync() on directory %(dir)s:'
|
||||
' %(err)s'),
|
||||
logging.warning('Unable to perform fsync() on directory %(dir)s:'
|
||||
' %(err)s',
|
||||
{'dir': dirpath, 'err': os.strerror(err.errno)})
|
||||
finally:
|
||||
if dirfd:
|
||||
@ -1174,9 +1173,9 @@ class LoggerFileObject(object):
|
||||
if value:
|
||||
if 'Connection reset by peer' in value:
|
||||
self.logger.error(
|
||||
_('%s: Connection reset by peer'), self.log_type)
|
||||
'%s: Connection reset by peer', self.log_type)
|
||||
else:
|
||||
self.logger.error(_('%(type)s: %(value)s'),
|
||||
self.logger.error('%(type)s: %(value)s',
|
||||
{'type': self.log_type, 'value': value})
|
||||
finally:
|
||||
self._cls_thread_local.already_called_write = False
|
||||
@ -1187,7 +1186,7 @@ class LoggerFileObject(object):
|
||||
|
||||
self._cls_thread_local.already_called_writelines = True
|
||||
try:
|
||||
self.logger.error(_('%(type)s: %(value)s'),
|
||||
self.logger.error('%(type)s: %(value)s',
|
||||
{'type': self.log_type,
|
||||
'value': '#012'.join(values)})
|
||||
finally:
|
||||
@ -1325,7 +1324,7 @@ class StatsdClient(object):
|
||||
except IOError as err:
|
||||
if self.logger:
|
||||
self.logger.warning(
|
||||
_('Error sending UDP message to %(target)r: %(err)s'),
|
||||
'Error sending UDP message to %(target)r: %(err)s',
|
||||
{'target': self._target, 'err': err})
|
||||
|
||||
def _open_socket(self):
|
||||
@ -1602,17 +1601,17 @@ class LogAdapter(logging.LoggerAdapter, object):
|
||||
if exc.errno in (errno.EIO, errno.ENOSPC):
|
||||
emsg = str(exc)
|
||||
elif exc.errno == errno.ECONNREFUSED:
|
||||
emsg = _('Connection refused')
|
||||
emsg = 'Connection refused'
|
||||
elif exc.errno == errno.ECONNRESET:
|
||||
emsg = _('Connection reset')
|
||||
emsg = 'Connection reset'
|
||||
elif exc.errno == errno.EHOSTUNREACH:
|
||||
emsg = _('Host unreachable')
|
||||
emsg = 'Host unreachable'
|
||||
elif exc.errno == errno.ENETUNREACH:
|
||||
emsg = _('Network unreachable')
|
||||
emsg = 'Network unreachable'
|
||||
elif exc.errno == errno.ETIMEDOUT:
|
||||
emsg = _('Connection timeout')
|
||||
emsg = 'Connection timeout'
|
||||
elif exc.errno == errno.EPIPE:
|
||||
emsg = _('Broken pipe')
|
||||
emsg = 'Broken pipe'
|
||||
else:
|
||||
call = self._exception
|
||||
elif isinstance(exc, (http_client.BadStatusLine,
|
||||
@ -1975,7 +1974,7 @@ def capture_stdio(logger, **kwargs):
|
||||
"""
|
||||
# log uncaught exceptions
|
||||
sys.excepthook = lambda * exc_info: \
|
||||
logger.critical(_('UNCAUGHT EXCEPTION'), exc_info=exc_info)
|
||||
logger.critical('UNCAUGHT EXCEPTION', exc_info=exc_info)
|
||||
|
||||
# collect stdio file desc not in use for logging
|
||||
stdio_files = [sys.stdin, sys.stdout, sys.stderr]
|
||||
@ -2029,12 +2028,12 @@ def parse_options(parser=None, once=False, test_args=None):
|
||||
|
||||
if not args:
|
||||
parser.print_usage()
|
||||
print(_("Error: missing config path argument"))
|
||||
print("Error: missing config path argument")
|
||||
sys.exit(1)
|
||||
config = os.path.abspath(args.pop(0))
|
||||
if not os.path.exists(config):
|
||||
parser.print_usage()
|
||||
print(_("Error: unable to locate %s") % config)
|
||||
print("Error: unable to locate %s" % config)
|
||||
sys.exit(1)
|
||||
|
||||
extra_args = []
|
||||
@ -2570,14 +2569,14 @@ def readconf(conf_path, section_name=None, log_name=None, defaults=None,
|
||||
else:
|
||||
success = c.read(conf_path)
|
||||
if not success:
|
||||
raise IOError(_("Unable to read config from %s") %
|
||||
raise IOError("Unable to read config from %s" %
|
||||
conf_path)
|
||||
if section_name:
|
||||
if c.has_section(section_name):
|
||||
conf = dict(c.items(section_name))
|
||||
else:
|
||||
raise ValueError(
|
||||
_("Unable to find %(section)s config section in %(conf)s") %
|
||||
"Unable to find %(section)s config section in %(conf)s" %
|
||||
{'section': section_name, 'conf': conf_path})
|
||||
if "log_name" not in conf:
|
||||
if log_name is not None:
|
||||
@ -2807,7 +2806,7 @@ def audit_location_generator(devices, datadir, suffix='',
|
||||
error_counter['unmounted'].append(device)
|
||||
if logger:
|
||||
logger.warning(
|
||||
_('Skipping %s as it is not mounted'), device)
|
||||
'Skipping %s as it is not mounted', device)
|
||||
continue
|
||||
if hook_pre_device:
|
||||
hook_pre_device(os.path.join(devices, device))
|
||||
@ -2820,7 +2819,7 @@ def audit_location_generator(devices, datadir, suffix='',
|
||||
error_counter.setdefault('unlistable_partitions', [])
|
||||
error_counter['unlistable_partitions'].append(datadir_path)
|
||||
if logger:
|
||||
logger.warning(_('Skipping %(datadir)s because %(err)s'),
|
||||
logger.warning('Skipping %(datadir)s because %(err)s',
|
||||
{'datadir': datadir_path, 'err': e})
|
||||
continue
|
||||
if partitions_filter:
|
||||
@ -3200,16 +3199,16 @@ def validate_sync_to(value, allowed_sync_hosts, realms_conf):
|
||||
data = value[2:].split('/')
|
||||
if len(data) != 4:
|
||||
return (
|
||||
_('Invalid X-Container-Sync-To format %r') % orig_value,
|
||||
'Invalid X-Container-Sync-To format %r' % orig_value,
|
||||
None, None, None)
|
||||
realm, cluster, account, container = data
|
||||
realm_key = realms_conf.key(realm)
|
||||
if not realm_key:
|
||||
return (_('No realm key for %r') % realm, None, None, None)
|
||||
return ('No realm key for %r' % realm, None, None, None)
|
||||
endpoint = realms_conf.endpoint(realm, cluster)
|
||||
if not endpoint:
|
||||
return (
|
||||
_('No cluster endpoint for %(realm)r %(cluster)r')
|
||||
'No cluster endpoint for %(realm)r %(cluster)r'
|
||||
% {'realm': realm, 'cluster': cluster},
|
||||
None, None, None)
|
||||
return (
|
||||
@ -3219,19 +3218,19 @@ def validate_sync_to(value, allowed_sync_hosts, realms_conf):
|
||||
p = urlparse(value)
|
||||
if p.scheme not in ('http', 'https'):
|
||||
return (
|
||||
_('Invalid scheme %r in X-Container-Sync-To, must be "//", '
|
||||
'"http", or "https".') % p.scheme,
|
||||
'Invalid scheme %r in X-Container-Sync-To, must be "//", '
|
||||
'"http", or "https".' % p.scheme,
|
||||
None, None, None)
|
||||
if not p.path:
|
||||
return (_('Path required in X-Container-Sync-To'), None, None, None)
|
||||
return ('Path required in X-Container-Sync-To', None, None, None)
|
||||
if p.params or p.query or p.fragment:
|
||||
return (
|
||||
_('Params, queries, and fragments not allowed in '
|
||||
'X-Container-Sync-To'),
|
||||
'Params, queries, and fragments not allowed in '
|
||||
'X-Container-Sync-To',
|
||||
None, None, None)
|
||||
if p.hostname not in allowed_sync_hosts:
|
||||
return (
|
||||
_('Invalid host %r in X-Container-Sync-To') % p.hostname,
|
||||
'Invalid host %r in X-Container-Sync-To' % p.hostname,
|
||||
None, None, None)
|
||||
return (None, value, None, None)
|
||||
|
||||
@ -4086,7 +4085,7 @@ def override_bytes_from_content_type(listing_dict, logger=None):
|
||||
listing_dict['bytes'] = int(swift_bytes)
|
||||
except ValueError:
|
||||
if logger:
|
||||
logger.exception(_("Invalid swift_bytes"))
|
||||
logger.exception("Invalid swift_bytes")
|
||||
|
||||
|
||||
def clean_content_type(value):
|
||||
@ -4405,7 +4404,7 @@ def document_iters_to_http_response_body(ranges_iter, boundary, multipart,
|
||||
pass
|
||||
else:
|
||||
logger.warning(
|
||||
_("More than one part in a single-part response?"))
|
||||
"More than one part in a single-part response?")
|
||||
|
||||
return string_along(response_body_iter, ranges_iter, logger)
|
||||
|
||||
|
@ -21,7 +21,6 @@ import errno
|
||||
import fcntl
|
||||
import os
|
||||
import signal
|
||||
from swift import gettext_ as _
|
||||
import sys
|
||||
from textwrap import dedent
|
||||
import time
|
||||
@ -207,8 +206,8 @@ def get_socket(conf):
|
||||
raise
|
||||
sleep(0.1)
|
||||
if not sock:
|
||||
raise Exception(_('Could not bind to %(addr)s:%(port)s '
|
||||
'after trying for %(timeout)s seconds') % {
|
||||
raise Exception('Could not bind to %(addr)s:%(port)s '
|
||||
'after trying for %(timeout)s seconds' % {
|
||||
'addr': bind_addr[0], 'port': bind_addr[1],
|
||||
'timeout': bind_timeout})
|
||||
# in my experience, sockets can hang around forever without keepalive
|
||||
@ -217,7 +216,7 @@ def get_socket(conf):
|
||||
if hasattr(socket, 'TCP_KEEPIDLE'):
|
||||
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, keepidle)
|
||||
if warn_ssl:
|
||||
ssl_warning_message = _('WARNING: SSL should only be enabled for '
|
||||
ssl_warning_message = ('WARNING: SSL should only be enabled for '
|
||||
'testing purposes. Use external SSL '
|
||||
'termination for a production deployment.')
|
||||
get_logger(conf).warning(ssl_warning_message)
|
||||
|
Loading…
Reference in New Issue
Block a user