Fix and enable gating on H703 - string localisation
Avoid using multi positional strings for localisation, as those are hard to translate to various languages. Also enable gating on H231 (which does not trigger). Change-Id: Ie22cf781bcd5ce7562a5e61cf08fde816e7af86a
This commit is contained in:
parent
1a8c62acb9
commit
e1d46b3770
2
tox.ini
2
tox.ini
@ -33,7 +33,7 @@ commands = {posargs}
|
|||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
show-source = True
|
show-source = True
|
||||||
ignore = E125,F401,F403,F811,F821,F841,H102,H103,H201,H23,H301,H306,H401,H402,H403,H404,H702,H703
|
ignore = E125,F401,F403,F811,F821,F841,H102,H103,H201,H233,H301,H306,H401,H402,H403,H404,H702
|
||||||
builtins = _
|
builtins = _
|
||||||
exclude=.venv,.tox,dist,doc,openstack,*egg,rsdns,tools,etc
|
exclude=.venv,.tox,dist,doc,openstack,*egg,rsdns,tools,etc
|
||||||
filename=*.py,trove-*
|
filename=*.py,trove-*
|
@ -55,14 +55,14 @@ class DatabaseModelBase(models.ModelBase):
|
|||||||
if not self.is_valid():
|
if not self.is_valid():
|
||||||
raise exception.InvalidModelError(errors=self.errors)
|
raise exception.InvalidModelError(errors=self.errors)
|
||||||
self['updated'] = utils.utcnow()
|
self['updated'] = utils.utcnow()
|
||||||
LOG.debug(_("Saving %s: %s") %
|
LOG.debug(_("Saving %(name)s: %(dict)s") %
|
||||||
(self.__class__.__name__, self.__dict__))
|
{'name': self.__class__.__name__, 'dict': self.__dict__})
|
||||||
return self.db_api.save(self)
|
return self.db_api.save(self)
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
self['updated'] = utils.utcnow()
|
self['updated'] = utils.utcnow()
|
||||||
LOG.debug(_("Deleting %s: %s") %
|
LOG.debug(_("Deleting %(name)s: %(dict)s") %
|
||||||
(self.__class__.__name__, self.__dict__))
|
{'name': self.__class__.__name__, 'dict': self.__dict__})
|
||||||
|
|
||||||
if self.preserve_on_delete:
|
if self.preserve_on_delete:
|
||||||
self['deleted_at'] = utils.utcnow()
|
self['deleted_at'] = utils.utcnow()
|
||||||
|
@ -54,13 +54,13 @@ class DnsRecord(ModelBase):
|
|||||||
def save(self):
|
def save(self):
|
||||||
if not self.is_valid():
|
if not self.is_valid():
|
||||||
raise exception.InvalidModelError(errors=self.errors)
|
raise exception.InvalidModelError(errors=self.errors)
|
||||||
LOG.debug(_("Saving %s: %s") %
|
LOG.debug(_("Saving %(name)s: %(dict)s") %
|
||||||
(self.__class__.__name__, self.__dict__))
|
{'name': self.__class__.__name__, 'dict': self.__dict__})
|
||||||
return get_db_api().save(self)
|
return get_db_api().save(self)
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
LOG.debug(_("Deleting %s: %s") %
|
LOG.debug(_("Deleting %(name)s: %(dict)s") %
|
||||||
(self.__class__.__name__, self.__dict__))
|
{'name': self.__class__.__name__, 'dict': self.__dict__})
|
||||||
return get_db_api().delete(self)
|
return get_db_api().delete(self)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -39,8 +39,8 @@ class AccountController(wsgi.Controller):
|
|||||||
def show(self, req, tenant_id, id):
|
def show(self, req, tenant_id, id):
|
||||||
"""Return a account and instances associated with a single account."""
|
"""Return a account and instances associated with a single account."""
|
||||||
LOG.info(_("req : '%s'\n\n") % req)
|
LOG.info(_("req : '%s'\n\n") % req)
|
||||||
LOG.info(_("Showing account information for '%s' to '%s'") %
|
LOG.info(_("Showing account information for '%(account)s' "
|
||||||
(id, tenant_id))
|
"to '%(tenant)s'") % {'account': id, 'tenant': tenant_id})
|
||||||
|
|
||||||
context = req.environ[wsgi.CONTEXT_KEY]
|
context = req.environ[wsgi.CONTEXT_KEY]
|
||||||
account = models.Account.load(context, id)
|
account = models.Account.load(context, id)
|
||||||
|
@ -209,8 +209,8 @@ class RootHistory(object):
|
|||||||
self.created = utils.utcnow()
|
self.created = utils.utcnow()
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
LOG.debug(_("Saving %s: %s") % (self.__class__.__name__,
|
LOG.debug(_("Saving %(name)s: %(dict)s") %
|
||||||
self.__dict__))
|
{'name': self.__class__.__name__, 'dict': self.__dict__})
|
||||||
return get_db_api().save(self)
|
return get_db_api().save(self)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -76,8 +76,7 @@ class SecurityGroup(DatabaseModelBase):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def create_for_instance(cls, instance_id, context):
|
def create_for_instance(cls, instance_id, context):
|
||||||
# Create a new security group
|
# Create a new security group
|
||||||
name = _("%s_%s") %\
|
name = "%s_%s" % (CONF.trove_security_group_name_prefix, instance_id)
|
||||||
(CONF.trove_security_group_name_prefix, instance_id)
|
|
||||||
description = _("Security Group for %s") % instance_id
|
description = _("Security Group for %s") % instance_id
|
||||||
sec_group = cls.create_sec_group(name, description, context)
|
sec_group = cls.create_sec_group(name, description, context)
|
||||||
|
|
||||||
|
@ -160,7 +160,8 @@ class API(proxy.RpcProxy):
|
|||||||
|
|
||||||
def delete_user(self, user):
|
def delete_user(self, user):
|
||||||
"""Make an asynchronous call to delete an existing database user"""
|
"""Make an asynchronous call to delete an existing database user"""
|
||||||
LOG.debug(_("Deleting user %s for Instance %s"), user, self.id)
|
LOG.debug(_("Deleting user %(user)s for Instance %(instance_id)s") %
|
||||||
|
{'user': user, 'instance_id': self.id})
|
||||||
self._cast("delete_user", user=user)
|
self._cast("delete_user", user=user)
|
||||||
|
|
||||||
def create_database(self, databases):
|
def create_database(self, databases):
|
||||||
@ -178,7 +179,9 @@ class API(proxy.RpcProxy):
|
|||||||
def delete_database(self, database):
|
def delete_database(self, database):
|
||||||
"""Make an asynchronous call to delete an existing database
|
"""Make an asynchronous call to delete an existing database
|
||||||
within the specified container"""
|
within the specified container"""
|
||||||
LOG.debug(_("Deleting database %s for Instance %s"), database, self.id)
|
LOG.debug(_("Deleting database %(database)s for "
|
||||||
|
"Instance %(instance_id)s") % {'database': database,
|
||||||
|
'instance_id': self.id})
|
||||||
self._cast("delete_database", database=database)
|
self._cast("delete_database", database=database)
|
||||||
|
|
||||||
def enable_root(self):
|
def enable_root(self):
|
||||||
@ -265,5 +268,7 @@ class API(proxy.RpcProxy):
|
|||||||
|
|
||||||
def create_backup(self, backup_id):
|
def create_backup(self, backup_id):
|
||||||
"""Make async call to create a full backup of this instance"""
|
"""Make async call to create a full backup of this instance"""
|
||||||
LOG.debug(_("Create Backup %s for Instance %s"), backup_id, self.id)
|
LOG.debug(_("Create Backup %(backup_id)s "
|
||||||
|
"for Instance %(instance_id)s") % {'backup_id': backup_id,
|
||||||
|
'instance_id': self.id})
|
||||||
self._cast("create_backup", backup_id=backup_id)
|
self._cast("create_backup", backup_id=backup_id)
|
||||||
|
@ -55,8 +55,8 @@ class AgentHeartBeat(dbmodels.DatabaseModelBase):
|
|||||||
if not self.is_valid():
|
if not self.is_valid():
|
||||||
raise exception.InvalidModelError(errors=self.errors)
|
raise exception.InvalidModelError(errors=self.errors)
|
||||||
self['updated_at'] = utils.utcnow()
|
self['updated_at'] = utils.utcnow()
|
||||||
LOG.debug(_("Saving %s: %s") %
|
LOG.debug(_("Saving %(name)s: %(dict)s") %
|
||||||
(self.__class__.__name__, self.__dict__))
|
{'name': self.__class__.__name__, 'dict': self.__dict__})
|
||||||
return get_db_api().save(self)
|
return get_db_api().save(self)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -193,9 +193,10 @@ class SimpleInstance(object):
|
|||||||
if self.db_info.server_status in ["ACTIVE", "SHUTDOWN", "DELETED"]:
|
if self.db_info.server_status in ["ACTIVE", "SHUTDOWN", "DELETED"]:
|
||||||
return InstanceStatus.SHUTDOWN
|
return InstanceStatus.SHUTDOWN
|
||||||
else:
|
else:
|
||||||
msg = _("While shutting down instance (%s): server had "
|
LOG.error(_("While shutting down instance (%(instance)s): "
|
||||||
"status (%s).")
|
"server had status (%(status)s).") %
|
||||||
LOG.error(msg % (self.id, self.db_info.server_status))
|
{'instance': self.id,
|
||||||
|
'status': self.db_info.server_status})
|
||||||
return InstanceStatus.ERROR
|
return InstanceStatus.ERROR
|
||||||
|
|
||||||
### Check against the service status.
|
### Check against the service status.
|
||||||
@ -455,8 +456,9 @@ class Instance(BuiltInstance):
|
|||||||
volume_size=volume_size,
|
volume_size=volume_size,
|
||||||
service_type=service_type,
|
service_type=service_type,
|
||||||
task_status=InstanceTasks.BUILDING)
|
task_status=InstanceTasks.BUILDING)
|
||||||
LOG.debug(_("Tenant %s created new Trove instance %s...")
|
LOG.debug(_("Tenant %(tenant)s created new "
|
||||||
% (context.tenant, db_info.id))
|
"Trove instance %(db)s...") %
|
||||||
|
{'tenant': context.tenant, 'db': db_info.id})
|
||||||
|
|
||||||
service_status = InstanceServiceStatus.create(
|
service_status = InstanceServiceStatus.create(
|
||||||
instance_id=db_info.id,
|
instance_id=db_info.id,
|
||||||
@ -611,8 +613,9 @@ def create_server_list_matcher(server_list):
|
|||||||
instance_id=instance_id, server_id=server_id)
|
instance_id=instance_id, server_id=server_id)
|
||||||
else:
|
else:
|
||||||
# Should never happen, but never say never.
|
# Should never happen, but never say never.
|
||||||
LOG.error(_("Server %s for instance %s was found twice!") %
|
LOG.error(_("Server %(server)s for instance %(instance)s was"
|
||||||
(server_id, instance_id))
|
"found twice!") % {'server': server_id,
|
||||||
|
'instance': instance_id})
|
||||||
raise exception.TroveError(uuid=instance_id)
|
raise exception.TroveError(uuid=instance_id)
|
||||||
|
|
||||||
return find_server
|
return find_server
|
||||||
|
@ -438,9 +438,10 @@ class FreshInstanceTasks(FreshInstance, NotifyMixin, ConfigurationMixin):
|
|||||||
return False
|
return False
|
||||||
elif (server.addresses == {} and
|
elif (server.addresses == {} and
|
||||||
server.status == InstanceStatus.ERROR):
|
server.status == InstanceStatus.ERROR):
|
||||||
msg = _("Instance IP not available, instance (%s): "
|
LOG.error(_("Instance IP not available, "
|
||||||
"server had status (%s).")
|
"instance (%(instance)s): "
|
||||||
LOG.error(msg % (self.id, server.status))
|
"server had status (%(status)s)." %
|
||||||
|
{'instance': self.id, 'status': server.status}))
|
||||||
raise TroveError(status=server.status)
|
raise TroveError(status=server.status)
|
||||||
|
|
||||||
poll_until(get_server, ip_is_available,
|
poll_until(get_server, ip_is_available,
|
||||||
|
Loading…
Reference in New Issue
Block a user