rse.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:rucio 作者: rucio01 项目源码 文件源码
def PUT(self, rse, scheme, hostname=None, port=None):
        """
        Updates attributes of an existing protocol entry. Because protocol identifier, hostname,
        and port are used as unique identifier they are immutable.

        HTTP Success:
            200 OK

        HTTP Error:
            400 Bad Request
            401 Unauthorized
            404 Resource not Found
            409 Conflict
            500 InternalError
        """
        json_data = data()
        try:
            parameter = loads(json_data)
        except ValueError:
            raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter dictionary')

        try:
            update_protocols(rse, issuer=ctx.env.get('issuer'), scheme=scheme, hostname=hostname, port=port, data=parameter)
        except InvalidObject, error:
            raise generate_http_error(400, 'InvalidObject', error[0][0])
        except RSEProtocolNotSupported, error:
            raise generate_http_error(404, 'RSEProtocolNotSupported', error[0][0])
        except RSENotFound, error:
            raise generate_http_error(404, 'RSENotFound', error[0][0])
        except RSEProtocolDomainNotSupported, error:
            raise generate_http_error(404, 'RSEProtocolDomainNotSupported', error[0][0])
        except RSEProtocolPriorityError, error:
            raise generate_http_error(409, 'RSEProtocolPriorityError', error[0][0])
        except RucioException, error:
            raise generate_http_error(500, error.__class__.__name__, error.args[0][0])
        except Exception, error:
            print error
            print format_exc()
            raise InternalError(error)

        raise OK()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号