From e67f63c1888d5caef8760540ac8d9705a89bd103 Mon Sep 17 00:00:00 2001 From: Trevor McCasland Date: Mon, 5 Dec 2016 08:19:18 -0600 Subject: 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 --- .../datastore/experimental/mongodb/service.py | 24 +++++++++++----------- .../datastore/experimental/postgresql/manager.py | 6 +++--- .../datastore/experimental/postgresql/service.py | 12 +++++------ 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/trove/guestagent/datastore/experimental/mongodb/service.py b/trove/guestagent/datastore/experimental/mongodb/service.py index e40494c0..5986af3f 100644 --- a/trove/guestagent/datastore/experimental/mongodb/service.py +++ b/trove/guestagent/datastore/experimental/mongodb/service.py @@ -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'.""" diff --git a/trove/guestagent/datastore/experimental/postgresql/manager.py b/trove/guestagent/datastore/experimental/postgresql/manager.py index b945131c..33a1d474 100644 --- a/trove/guestagent/datastore/experimental/postgresql/manager.py +++ b/trove/guestagent/datastore/experimental/postgresql/manager.py @@ -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) diff --git a/trove/guestagent/datastore/experimental/postgresql/service.py b/trove/guestagent/datastore/experimental/postgresql/service.py index 1f7ce687..7ac3e47e 100644 --- a/trove/guestagent/datastore/experimental/postgresql/service.py +++ b/trove/guestagent/datastore/experimental/postgresql/service.py @@ -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, ) -- cgit v1.2.1