diff --git a/trove/common/exception.py b/trove/common/exception.py index e0e0feea96..00d70f1cd0 100644 --- a/trove/common/exception.py +++ b/trove/common/exception.py @@ -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 " diff --git a/trove/common/wsgi.py b/trove/common/wsgi.py index 3be631f7eb..4c8673d5b2 100644 --- a/trove/common/wsgi.py +++ b/trove/common/wsgi.py @@ -368,7 +368,8 @@ class Controller(object): exception.LocalStorageNotSupported, exception.DatastoreOperationNotSupported, exception.ClusterInstanceOperationNotSupported, - exception.ClusterDatastoreNotSupported + exception.ClusterDatastoreNotSupported, + exception.LogsNotAvailable ], } diff --git a/trove/instance/service.py b/trove/instance/service.py index 184122f494..1e558f5f1a 100644 --- a/trove/instance/service.py +++ b/trove/instance/service.py @@ -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)