Add i18n tranlastion to guestagent datastore 2/5

This is 2 of 5 commits to add i18n translation to the guestagent
datastore directory

Custom hacking rules will come later to enforce this style.

Change-Id: I80f2ea6a20944cfbfdc79a8a71ad744f23aeaac1
Depends-On: I6fb2bdcc4b83457e08b24599fb4a297ef6ec6c14
This commit is contained in:
Trevor McCasland 2016-12-05 08:19:18 -06:00 committed by amrith
parent 4f9c538f68
commit e67f63c188
3 changed files with 21 additions and 21 deletions

View File

@ -521,13 +521,13 @@ class MongoDBAdmin(object):
try:
user.check_create()
if self._get_user_record(user.name, client=client):
raise ValueError('User with name %(user)s already '
'exists.' % {'user': user.name})
raise ValueError(_('User with name %(user)s already '
'exists.') % {'user': user.name})
self.create_validated_user(user, client=client)
except (ValueError, pymongo.errors.PyMongoError) as e:
LOG.error(e)
LOG.warning('Skipping creation of user with name %(user)s'
% {'user': user.name})
LOG.warning(_('Skipping creation of user with name '
'%(user)s') % {'user': user.name})
def delete_validated_user(self, user):
"""Deletes a user from their database. The caller should ensure that
@ -551,8 +551,8 @@ class MongoDBAdmin(object):
"""Get the user's record."""
user = models.MongoDBUser(name)
if user.is_ignored:
LOG.warning('Skipping retrieval of user with reserved '
'name %(user)s' % {'user': user.name})
LOG.warning(_('Skipping retrieval of user with reserved '
'name %(user)s') % {'user': user.name})
return None
if client:
user_info = client.admin.system.users.find_one(
@ -570,8 +570,8 @@ class MongoDBAdmin(object):
"""Check that a user exists."""
user = self._get_user_record(name)
if not user:
raise ValueError('User with name %(user)s does not'
'exist.' % {'user': name})
raise ValueError(_('User with name %(user)s does not'
'exist.') % {'user': name})
return user
def get_user(self, name):
@ -611,8 +611,8 @@ class MongoDBAdmin(object):
self._create_user_with_client(user, admin_client)
except (ValueError, pymongo.errors.PyMongoError) as e:
LOG.error(e)
LOG.warning('Skipping password change for user with '
'name %(user)s' % {'user': user.name})
LOG.warning(_('Skipping password change for user with '
'name %(user)s') % {'user': user.name})
def update_attributes(self, name, user_attrs):
"""Update user attributes."""
@ -622,9 +622,9 @@ class MongoDBAdmin(object):
user.password = password
self.change_passwords([user.serialize()])
if user_attrs.get('name'):
LOG.warning('Changing user name is not supported.')
LOG.warning(_('Changing user name is not supported.'))
if user_attrs.get('host'):
LOG.warning('Changing user host is not supported.')
LOG.warning(_('Changing user host is not supported.'))
def enable_root(self, password=None):
"""Create a user 'root' with role 'root'."""

View File

@ -234,7 +234,7 @@ class Manager(manager.Manager):
self.app.set_current_admin_user(os_admin)
if snapshot:
LOG.info("Found snapshot info: " + str(snapshot))
LOG.info(_("Found snapshot info: ") + str(snapshot))
self.attach_replica(context, snapshot, snapshot['config'])
self.app.start_db()
@ -284,7 +284,7 @@ class Manager(manager.Manager):
lsn = self.app.pg_last_xlog_replay_location()
else:
lsn = self.app.pg_current_xlog_location()
LOG.info("Last xlog location found: %s" % lsn)
LOG.info(_("Last xlog location found: %s") % lsn)
return lsn
def get_last_txn(self, context):
@ -299,7 +299,7 @@ class Manager(manager.Manager):
def _wait_for_txn():
lsn = self.app.pg_last_xlog_replay_location()
LOG.info("Last xlog location found: %s" % lsn)
LOG.info(_("Last xlog location found: %s") % lsn)
return lsn >= txn
try:
utils.poll_until(_wait_for_txn, time_out=120)

View File

@ -257,7 +257,7 @@ class PgSqlApp(object):
if not self.configuration_manager.has_system_override(
BACKUP_CFG_OVERRIDE):
return
LOG.info("Removing configuration changes for backups")
LOG.info(_("Removing configuration changes for backups"))
self.configuration_manager.remove_system_override(BACKUP_CFG_OVERRIDE)
self.remove_wal_archive_dir()
self.restart()
@ -272,7 +272,7 @@ class PgSqlApp(object):
if self.configuration_manager.has_system_override(BACKUP_CFG_OVERRIDE):
return
LOG.info("Applying changes to WAL config for use by base backups")
LOG.info(_("Applying changes to WAL config for use by base backups"))
wal_arch_loc = self.wal_archive_location
if not os.path.isdir(wal_arch_loc):
raise RuntimeError(_("Cannot enable backup as WAL dir '%s' does "
@ -335,8 +335,8 @@ class PgSqlApp(object):
pkg.PkgDownloadError, pkg.PkgSignError,
pkg.PkgBrokenError):
LOG.exception(
"{guest_id}: There was a package manager error while "
"trying to install ({packages}).".format(
_("{guest_id}: There was a package manager error while "
"trying to install ({packages}).").format(
guest_id=CONF.guest_id,
packages=packages,
)
@ -344,8 +344,8 @@ class PgSqlApp(object):
raise
except Exception:
LOG.exception(
"{guest_id}: The package manager encountered an unknown "
"error while trying to install ({packages}).".format(
_("{guest_id}: The package manager encountered an unknown "
"error while trying to install ({packages}).").format(
guest_id=CONF.guest_id,
packages=packages,
)