Example #1
0
    def detail(self, req):
        resp_backup = super(BackupsController, self).detail(req)
        context = req.environ['cinder.context']
        req_version = req.api_version_request

        if req_version.matches(mv.BACKUP_PROJECT):
            try:
                backup_api.check_policy(context, 'backup_project_attribute')
                for bak in resp_backup['backups']:
                    self._add_backup_project_attribute(req, bak)
            except exception.PolicyNotAuthorized:
                pass
        return resp_backup
Example #2
0
    def detail(self, req):
        resp_backup = super(BackupsController, self).detail(req)
        context = req.environ['cinder.context']
        req_version = req.api_version_request

        if req_version.matches(BACKUP_TENANT_MICRO_VERSION):
            try:
                backup_api.check_policy(context, 'backup_project_attribute')
                for bak in resp_backup['backups']:
                    self._add_backup_project_attribute(req, bak)
            except exception.PolicyNotAuthorized:
                pass
        return resp_backup
Example #3
0
    def show(self, req, id):
        """Return data about the given backup."""
        LOG.debug('Show backup with id %s.', id)
        context = req.environ['cinder.context']
        req_version = req.api_version_request

        # Not found exception will be handled at the wsgi level
        backup = self.backup_api.get(context, backup_id=id)
        req.cache_db_backup(backup)

        resp_backup = self._view_builder.detail(req, backup)
        if req_version.matches(mv.BACKUP_PROJECT):
            try:
                backup_api.check_policy(context, 'backup_project_attribute')
                self._add_backup_project_attribute(req, resp_backup['backup'])
            except exception.PolicyNotAuthorized:
                pass
        return resp_backup
Example #4
0
    def show(self, req, id):
        """Return data about the given backup."""
        LOG.debug('Show backup with id %s.', id)
        context = req.environ['cinder.context']
        req_version = req.api_version_request

        # Not found exception will be handled at the wsgi level
        backup = self.backup_api.get(context, backup_id=id)
        req.cache_db_backup(backup)

        resp_backup = self._view_builder.detail(req, backup)
        if req_version.matches(BACKUP_TENANT_MICRO_VERSION):
            try:
                backup_api.check_policy(context, 'backup_project_attribute')
                self._add_backup_project_attribute(req, resp_backup['backup'])
            except exception.PolicyNotAuthorized:
                pass
        return resp_backup