summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-07-21 23:11:18 +0000
committerGerrit Code Review <review@openstack.org>2016-07-21 23:11:18 +0000
commita4b43bcd01ee56a56348521362777103ed84681a (patch)
treed70ee2a1cdb141a01c8e6609b95138a338b33d28
parentc1ba85406e4f59ec27854e1e8bc5b2f98ff358d1 (diff)
parentb985ac4afe2d06dfac7b356294fbc90da03d0819 (diff)
downloadglance_store-a4b43bcd01ee56a56348521362777103ed84681a.tar.gz
Merge "Cleanup i18n marker functions to match Oslo usage"
-rw-r--r--glance_store/_drivers/filesystem.py5
-rw-r--r--glance_store/_drivers/http.py6
-rw-r--r--glance_store/_drivers/rbd.py5
-rw-r--r--glance_store/_drivers/s3.py4
-rw-r--r--glance_store/_drivers/swift/store.py23
-rw-r--r--glance_store/_drivers/swift/utils.py53
-rw-r--r--glance_store/backend.py4
-rw-r--r--glance_store/capabilities.py3
-rw-r--r--glance_store/driver.py3
-rw-r--r--glance_store/exceptions.py3
10 files changed, 46 insertions, 63 deletions
diff --git a/glance_store/_drivers/filesystem.py b/glance_store/_drivers/filesystem.py
index dc89e30..4b0e804 100644
--- a/glance_store/_drivers/filesystem.py
+++ b/glance_store/_drivers/filesystem.py
@@ -37,14 +37,11 @@ from glance_store import capabilities
from glance_store.common import utils
import glance_store.driver
from glance_store import exceptions
-from glance_store import i18n
+from glance_store.i18n import _, _LE, _LW
import glance_store.location
LOG = logging.getLogger(__name__)
-_ = i18n._
-_LE = i18n._LE
-_LW = i18n._LW
_FILESYSTEM_CONFIGS = [
cfg.StrOpt('filesystem_store_datadir',
diff --git a/glance_store/_drivers/http.py b/glance_store/_drivers/http.py
index 207b1c9..985282a 100644
--- a/glance_store/_drivers/http.py
+++ b/glance_store/_drivers/http.py
@@ -25,7 +25,7 @@ import requests
from glance_store import capabilities
import glance_store.driver
from glance_store import exceptions
-from glance_store.i18n import _
+from glance_store.i18n import _, _LI
import glance_store.location
LOG = logging.getLogger(__name__)
@@ -110,7 +110,7 @@ class StoreLocation(glance_store.location.StoreLocation):
else:
self.user = None
if netloc == '':
- LOG.info(_("No address specified in HTTP URL"))
+ LOG.info(_LI("No address specified in HTTP URL"))
raise exceptions.BadStoreUri(uri=uri)
else:
# IPv6 address has the following format [1223:0:0:..]:<some_port>
@@ -268,7 +268,7 @@ class Store(glance_store.driver.Store):
if conn.is_redirect and conn.status_code not in (301, 302):
reason = (_("The HTTP URL %(url)s attempted to redirect "
- "with an invalid %(status)s status code.") %
+ "with an invalid %(status)s status code."),
{'url': loc.path, 'status': conn.status_code})
LOG.info(reason)
raise exceptions.BadStoreUri(message=reason)
diff --git a/glance_store/_drivers/rbd.py b/glance_store/_drivers/rbd.py
index 78852bf..c9a1a07 100644
--- a/glance_store/_drivers/rbd.py
+++ b/glance_store/_drivers/rbd.py
@@ -32,8 +32,7 @@ from glance_store import capabilities
from glance_store.common import utils
from glance_store import driver
from glance_store import exceptions
-from glance_store import i18n
-from glance_store.i18n import _
+from glance_store.i18n import _, _LE, _LI
from glance_store import location
try:
@@ -50,8 +49,6 @@ DEFAULT_CHUNKSIZE = 8 # in MiB
DEFAULT_SNAPNAME = 'snap'
LOG = logging.getLogger(__name__)
-_LI = i18n._LI
-_LE = i18n._LE
_RBD_OPTS = [
cfg.IntOpt('rbd_store_chunk_size', default=DEFAULT_CHUNKSIZE,
diff --git a/glance_store/_drivers/s3.py b/glance_store/_drivers/s3.py
index da45122..499e1e2 100644
--- a/glance_store/_drivers/s3.py
+++ b/glance_store/_drivers/s3.py
@@ -36,12 +36,10 @@ from glance_store import capabilities
from glance_store.common import utils
import glance_store.driver
from glance_store import exceptions
-from glance_store.i18n import _
+from glance_store.i18n import _, _LE, _LI
import glance_store.location
LOG = logging.getLogger(__name__)
-_LE = glance_store.i18n._LE
-_LI = glance_store.i18n._LI
DEFAULT_LARGE_OBJECT_SIZE = 100 # 100M
DEFAULT_LARGE_OBJECT_CHUNK_SIZE = 10 # 10M
diff --git a/glance_store/_drivers/swift/store.py b/glance_store/_drivers/swift/store.py
index 01cc404..8a3b8b9 100644
--- a/glance_store/_drivers/swift/store.py
+++ b/glance_store/_drivers/swift/store.py
@@ -43,13 +43,11 @@ from glance_store._drivers.swift import utils as sutils
from glance_store import capabilities
from glance_store import driver
from glance_store import exceptions
-from glance_store import i18n
+from glance_store.i18n import _, _LE, _LI
from glance_store import location
-_ = i18n._
LOG = logging.getLogger(__name__)
-_LI = i18n._LI
DEFAULT_CONTAINER = 'glance'
DEFAULT_LARGE_OBJECT_SIZE = 5 * units.Ki # 5GB
@@ -307,16 +305,16 @@ def swift_retry_iter(resp_iter, length, store, location, manager):
if bytes_read != length:
if retries == store.conf.glance_store.swift_store_retry_get_count:
# terminate silently and let higher level decide
- LOG.error(_("Stopping Swift retries after %d "
- "attempts") % retries)
+ LOG.error(_LE("Stopping Swift retries after %d "
+ "attempts") % retries)
break
else:
retries += 1
glance_conf = store.conf.glance_store
retry_count = glance_conf.swift_store_retry_get_count
- LOG.info(_("Retrying Swift connection "
- "(%(retries)d/%(max_retries)d) with "
- "range=%(start)d-%(end)d") %
+ LOG.info(_LI("Retrying Swift connection "
+ "(%(retries)d/%(max_retries)d) with "
+ "range=%(start)d-%(end)d"),
{'retries': retries,
'max_retries': retry_count,
'start': bytes_read,
@@ -727,9 +725,9 @@ class BaseStore(driver.Store):
except Exception:
# Delete orphaned segments from swift backend
with excutils.save_and_reraise_exception():
- LOG.exception(_("Error during chunked upload "
- "to backend, deleting stale "
- "chunks"))
+ reason = _LE("Error during chunked upload to "
+ "backend, deleting stale chunks")
+ LOG.exception(reason)
self._delete_stale_chunks(
manager.get_connection(),
location.container,
@@ -1189,7 +1187,8 @@ class MultiTenantStore(BaseStore):
default_ref = self.conf.glance_store.default_swift_reference
default_swift_reference = ref_params.get(default_ref)
if not default_swift_reference:
- reason = _("default_swift_reference %s is required.") % default_ref
+ reason = _("default_swift_reference %s is "
+ "required."), default_ref
LOG.error(reason)
raise exceptions.BadStoreConfiguration(message=reason)
diff --git a/glance_store/_drivers/swift/utils.py b/glance_store/_drivers/swift/utils.py
index e172ebe..97a3612 100644
--- a/glance_store/_drivers/swift/utils.py
+++ b/glance_store/_drivers/swift/utils.py
@@ -20,44 +20,42 @@ from oslo_config import cfg
from six.moves import configparser
from glance_store import exceptions
-from glance_store import i18n
+from glance_store.i18n import _, _LE
swift_opts = [
cfg.StrOpt('default_swift_reference',
default="ref1",
- help=i18n._('The reference to the default swift account/backing'
- ' store parameters to use for adding new images.')),
+ help=_('The reference to the default swift account/backing'
+ ' store parameters to use for adding new images.')),
cfg.StrOpt('swift_store_auth_version', default='2',
- help=i18n._('Version of the authentication service to use. '
- 'Valid versions are 2 and 3 for keystone and 1 '
- '(deprecated) for swauth and rackspace.'),
+ help=_('Version of the authentication service to use. '
+ 'Valid versions are 2 and 3 for keystone and 1 '
+ '(deprecated) for swauth and rackspace.'),
deprecated_for_removal=True,
- deprecated_reason=i18n._('Use "auth_version" in '
- 'swift_store_config_file.')
- ),
+ deprecated_reason=_('Use "auth_version" in '
+ 'swift_store_config_file.')),
cfg.StrOpt('swift_store_auth_address',
- help=i18n._('The address where the Swift authentication '
- 'service is listening.'),
+ help=_('The address where the Swift authentication '
+ 'service is listening.'),
deprecated_for_removal=True,
- deprecated_reason=i18n._('Use "auth_address" in '
- 'swift_store_config_file')
- ),
+ deprecated_reason=_('Use "auth_address" in '
+ 'swift_store_config_file')),
cfg.StrOpt('swift_store_user', secret=True,
- help=i18n._('The user to authenticate against the Swift '
- 'authentication service.'),
+ help=_('The user to authenticate against the Swift '
+ 'authentication service.'),
deprecated_for_removal=True,
- deprecated_reason=i18n._('Use "user" in '
- 'swift_store_config_file.')),
+ deprecated_reason=_('Use "user" in '
+ 'swift_store_config_file.')),
cfg.StrOpt('swift_store_key', secret=True,
- help=i18n._('Auth key for the user authenticating against the '
- 'Swift authentication service.'),
+ help=_('Auth key for the user authenticating against the '
+ 'Swift authentication service.'),
deprecated_for_removal=True,
- deprecated_reason=i18n._('Use "key" in '
- 'swift_store_config_file.')
+ deprecated_reason=_('Use "key" in '
+ 'swift_store_config_file.')
),
cfg.StrOpt('swift_store_config_file', secret=True,
- help=i18n._('The config file that has the swift account(s)'
- 'configs.')),
+ help=_('The config file that has the swift account(s)'
+ 'configs.')),
]
_config_defaults = {'user_domain_id': 'default',
@@ -113,8 +111,8 @@ class SwiftParams(object):
conf_file = self.conf.find_file(scf)
CONFIG.read(conf_file)
except Exception as e:
- msg = (i18n._("swift config file "
- "%(conf)s:%(exc)s not found") %
+ msg = (_("swift config file "
+ "%(conf)s:%(exc)s not found"),
{'conf': self.conf.glance_store.swift_store_config_file,
'exc': e})
LOG.error(msg)
@@ -143,6 +141,5 @@ class SwiftParams(object):
account_params[ref] = reference
except (ValueError, SyntaxError, configparser.NoOptionError) as e:
- LOG.exception(i18n._("Invalid format of swift store config"
- "cfg"))
+ LOG.exception(_LE("Invalid format of swift store config cfg"))
return account_params
diff --git a/glance_store/backend.py b/glance_store/backend.py
index 2320e45..0cf01e3 100644
--- a/glance_store/backend.py
+++ b/glance_store/backend.py
@@ -23,15 +23,13 @@ from stevedore import extension
from glance_store import capabilities
from glance_store import exceptions
-from glance_store import i18n
+from glance_store.i18n import _
from glance_store import location
CONF = cfg.CONF
LOG = logging.getLogger(__name__)
-_ = i18n._
-
_STORE_OPTS = [
cfg.ListOpt('stores', default=['file', 'http'],
help=_("List of stores enabled. Valid stores are: "
diff --git a/glance_store/capabilities.py b/glance_store/capabilities.py
index 8da8ce3..d6963da 100644
--- a/glance_store/capabilities.py
+++ b/glance_store/capabilities.py
@@ -24,9 +24,8 @@ from eventlet import tpool
from oslo_utils import reflection
from glance_store import exceptions
-from glance_store import i18n
+from glance_store.i18n import _LW
-_LW = i18n._LW
_STORE_CAPABILITES_UPDATE_SCHEDULING_BOOK = {}
_STORE_CAPABILITES_UPDATE_SCHEDULING_LOCK = threading.Lock()
LOG = logging.getLogger(__name__)
diff --git a/glance_store/driver.py b/glance_store/driver.py
index 9e805cd..45f69ce 100644
--- a/glance_store/driver.py
+++ b/glance_store/driver.py
@@ -25,9 +25,8 @@ from oslo_utils import units
from glance_store import capabilities
from glance_store import exceptions
-from glance_store import i18n
+from glance_store.i18n import _
-_ = i18n._
LOG = logging.getLogger(__name__)
diff --git a/glance_store/exceptions.py b/glance_store/exceptions.py
index fe59630..e6b19a4 100644
--- a/glance_store/exceptions.py
+++ b/glance_store/exceptions.py
@@ -20,9 +20,8 @@ import six
import six.moves.urllib.parse as urlparse
import warnings
-from glance_store import i18n
+from glance_store.i18n import _
warnings.simplefilter('always')
-_ = i18n._
class BackendException(Exception):