Merge "Add error handling when Swift is not installed"
This commit is contained in:
commit
eab1b7f236
@ -684,6 +684,11 @@ class LogAccessForbidden(Forbidden):
|
||||
message = _("You must be admin to %(action)s log '%(log)s'.")
|
||||
|
||||
|
||||
class LogsNotAvailable(Forbidden):
|
||||
|
||||
message = _("Log actions are not supported.")
|
||||
|
||||
|
||||
class SlaveOperationNotSupported(TroveError):
|
||||
|
||||
message = _("The '%(operation)s' operation is not supported for slaves in "
|
||||
|
@ -368,7 +368,8 @@ class Controller(object):
|
||||
exception.LocalStorageNotSupported,
|
||||
exception.DatastoreOperationNotSupported,
|
||||
exception.ClusterInstanceOperationNotSupported,
|
||||
exception.ClusterDatastoreNotSupported
|
||||
exception.ClusterDatastoreNotSupported,
|
||||
exception.LogsNotAvailable
|
||||
],
|
||||
}
|
||||
|
||||
|
@ -484,6 +484,12 @@ class InstanceController(wsgi.Controller):
|
||||
"""Return all information about all logs for an instance."""
|
||||
LOG.debug("Listing logs for tenant %s", tenant_id)
|
||||
context = req.environ[wsgi.CONTEXT_KEY]
|
||||
|
||||
try:
|
||||
backup_model.verify_swift_auth_token(context)
|
||||
except exception.SwiftNotFound:
|
||||
raise exception.LogsNotAvailable()
|
||||
|
||||
instance = models.Instance.load(context, id)
|
||||
if not instance:
|
||||
raise exception.NotFound(uuid=id)
|
||||
@ -496,6 +502,12 @@ class InstanceController(wsgi.Controller):
|
||||
"""Processes a guest log."""
|
||||
LOG.info("Processing log for tenant %s", tenant_id)
|
||||
context = req.environ[wsgi.CONTEXT_KEY]
|
||||
|
||||
try:
|
||||
backup_model.verify_swift_auth_token(context)
|
||||
except exception.SwiftNotFound:
|
||||
raise exception.LogsNotAvailable()
|
||||
|
||||
instance = models.Instance.load(context, id)
|
||||
if not instance:
|
||||
raise exception.NotFound(uuid=id)
|
||||
|
Loading…
Reference in New Issue
Block a user