コード例 #1
0
ファイル: backups.py プロジェクト: liujicun/cinder
    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
コード例 #2
0
ファイル: backups.py プロジェクト: ebalduf/cinder-backports
    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
コード例 #3
0
ファイル: backups.py プロジェクト: liujicun/cinder
    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
コード例 #4
0
ファイル: backups.py プロジェクト: ebalduf/cinder-backports
    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