)]}'
{"lower-constraints.txt":[{"author":{"_account_id":2903,"name":"Morgan Fainberg","email":"morgan.fainberg@gmail.com","username":"mdrnstm"},"change_message_id":"b8bd064206596334f2cb586771c8c549ce9f3fad","unresolved":false,"context_lines":[{"line_number":1,"context_line":"bandit\u003d\u003d1.4.0"},{"line_number":2,"context_line":"hacking\u003d\u003d0.12.0"},{"line_number":3,"context_line":"keystoneauth1\u003d\u003d3.9.0"},{"line_number":4,"context_line":"keystonemiddleware\u003d\u003d4.17.0"},{"line_number":5,"context_line":"oslo.config\u003d\u003d5.2.0"},{"line_number":6,"context_line":"oslo.i18n\u003d\u003d3.15.3"},{"line_number":7,"context_line":"openstackdocstheme\u003d\u003d1.20.0"}],"source_content_type":"text/plain","patch_set":10,"id":"3f79a3b5_bb72c811","line":4,"range":{"start_line":4,"start_character":0,"end_line":4,"end_character":26},"updated":"2018-09-10 15:33:32.000000000","message":"Remove this.","commit_id":"9e7b0272bb3555c3f61154befdf7d8f5636682d7"}],"oslo_limit/exception.py":[{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"65b34acce9f353c9a94040d6cf63a69eddf38b3b","unresolved":false,"context_lines":[{"line_number":15,"context_line":""},{"line_number":16,"context_line":"class LimitNotFound(Exception):"},{"line_number":17,"context_line":"    def __init__(self, resource):"},{"line_number":18,"context_line":"        msg \u003d _(\"Can\u0027t find the limit fo resource %(resource)s.\""},{"line_number":19,"context_line":"                ) % {\u0027resource\u0027: resource}"},{"line_number":20,"context_line":"        super(LimitNotFound, self).__init__(msg)"},{"line_number":21,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"3f79a3b5_f7c6fd68","line":18,"range":{"start_line":18,"start_character":38,"end_line":18,"end_character":40},"updated":"2018-08-29 15:41:11.000000000","message":"for*?","commit_id":"7e1e3686a6ecc1c9fd7e238561c3ad7a849ccdec"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"65b34acce9f353c9a94040d6cf63a69eddf38b3b","unresolved":false,"context_lines":[{"line_number":22,"context_line":""},{"line_number":23,"context_line":"class ClaimExceedLimit(Exception):"},{"line_number":24,"context_line":"    def __init__(self, usage, quantity, limit):"},{"line_number":25,"context_line":"        msg \u003d _(\"%(usage)s resource have been used. Claim %(quantity)s will \""},{"line_number":26,"context_line":"                \"exceed current limit %(limit)s\""},{"line_number":27,"context_line":"                ) % {\u0027usage\u0027: usage,"},{"line_number":28,"context_line":"                     \u0027quantity\u0027: quantity,"}],"source_content_type":"text/x-python","patch_set":5,"id":"3f79a3b5_d78c2137","line":25,"range":{"start_line":25,"start_character":71,"end_line":25,"end_character":75},"updated":"2018-08-29 15:41:11.000000000","message":"I\u0027d adjust the wording here slightly because it currently seems like the claim is still going to be applied despite being an exception.","commit_id":"7e1e3686a6ecc1c9fd7e238561c3ad7a849ccdec"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"ea907e58cd5d4ecec6cfdcb64bdaa92c9ca7423e","unresolved":false,"context_lines":[{"line_number":23,"context_line":"class ClaimExceedLimit(Exception):"},{"line_number":24,"context_line":"    def __init__(self, usage, quantity, limit):"},{"line_number":25,"context_line":"        msg \u003d _(\"%(usage)s resource have been used. Claiming %(quantity)s \""},{"line_number":26,"context_line":"                \"would exceed current limit %(limit)s\""},{"line_number":27,"context_line":"                ) % {\u0027usage\u0027: usage,"},{"line_number":28,"context_line":"                     \u0027quantity\u0027: quantity,"},{"line_number":29,"context_line":"                     \u0027limit\u0027: limit}"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_03c89152","line":26,"updated":"2018-09-05 16:13:02.000000000","message":"nit: We could include the resource here, too. For example, the message could read.\n\n  10 cores have been used. Claiming 2 cores would exceed the\n  current limit of 10.\n\nSo, the string injection format might be:\n\n  \"%(usage)s %(resource)s have been used. Claiming %(quantity)s \"\n  \"%(resource)s would exceed the current limit of %(limit)s\"\n\nWhich is a little busy, but we should have all of these things available when raising the exception, so we should be able to craft a pretty specific message.","commit_id":"5722b59eeb3dfe8f41eae3c874ecd64fe7c50ebc"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"a9a6c61fd6b985502b580f06c7bd013fd99822e7","unresolved":false,"context_lines":[{"line_number":23,"context_line":"class ClaimExceedLimit(Exception):"},{"line_number":24,"context_line":"    def __init__(self, usage, quantity, limit):"},{"line_number":25,"context_line":"        msg \u003d _(\"%(usage)s resource have been used. Claiming %(quantity)s \""},{"line_number":26,"context_line":"                \"would exceed current limit %(limit)s\""},{"line_number":27,"context_line":"                ) % {\u0027usage\u0027: usage,"},{"line_number":28,"context_line":"                     \u0027quantity\u0027: quantity,"},{"line_number":29,"context_line":"                     \u0027limit\u0027: limit}"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_abd6444e","line":26,"in_reply_to":"3f79a3b5_03c89152","updated":"2018-09-06 07:25:23.000000000","message":"Done","commit_id":"5722b59eeb3dfe8f41eae3c874ecd64fe7c50ebc"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"a97f479524aaad7ca107dde88ce4147ea6bed9aa","unresolved":false,"context_lines":[{"line_number":20,"context_line":"        super(LimitNotFound, self).__init__(msg)"},{"line_number":21,"context_line":""},{"line_number":22,"context_line":""},{"line_number":23,"context_line":"class ClaimExceedLimit(Exception):"},{"line_number":24,"context_line":"    def __init__(self, usage, quantity, limit, resource):"},{"line_number":25,"context_line":"        msg \u003d _(\"%(usage)s %(resource)s have been used. Claiming %(quantity)s \""},{"line_number":26,"context_line":"                \"%(resource)s would exceed the current limit of %(limit)s\""}],"source_content_type":"text/x-python","patch_set":10,"id":"3f79a3b5_2af2e0e4","line":23,"range":{"start_line":23,"start_character":6,"end_line":23,"end_character":22},"updated":"2018-09-10 18:26:46.000000000","message":"Femto-nit: I would prefer this to be called ClaimExceedsLimit just because it reads better.","commit_id":"9e7b0272bb3555c3f61154befdf7d8f5636682d7"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"521d2351e63beb79ed9c882c096a9abfaa02ee49","unresolved":false,"context_lines":[{"line_number":20,"context_line":"        super(LimitNotFound, self).__init__(msg)"},{"line_number":21,"context_line":""},{"line_number":22,"context_line":""},{"line_number":23,"context_line":"class ClaimExceedLimit(Exception):"},{"line_number":24,"context_line":"    def __init__(self, usage, quantity, limit, resource):"},{"line_number":25,"context_line":"        msg \u003d _(\"%(usage)s %(resource)s have been used. Claiming %(quantity)s \""},{"line_number":26,"context_line":"                \"%(resource)s would exceed the current limit of %(limit)s\""}],"source_content_type":"text/x-python","patch_set":10,"id":"3f79a3b5_6031d059","line":23,"range":{"start_line":23,"start_character":6,"end_line":23,"end_character":22},"in_reply_to":"3f79a3b5_2af2e0e4","updated":"2018-09-11 09:01:43.000000000","message":"Done","commit_id":"9e7b0272bb3555c3f61154befdf7d8f5636682d7"}],"oslo_limit/limit.py":[{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"65b34acce9f353c9a94040d6cf63a69eddf38b3b","unresolved":false,"context_lines":[{"line_number":59,"context_line":""},{"line_number":60,"context_line":"class Enforcer(object):"},{"line_number":61,"context_line":""},{"line_number":62,"context_line":"    def __init__(self, context, conf, claim, callback\u003dNone, verify\u003dTrue,"},{"line_number":63,"context_line":"                 session\u003dNone):"},{"line_number":64,"context_line":"        \"\"\"Context manager for checking usage against resource claims."},{"line_number":65,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"3f79a3b5_52c6df4b","line":62,"range":{"start_line":62,"start_character":23,"end_line":62,"end_character":30},"updated":"2018-08-29 15:41:11.000000000","message":"I have similar feelings about this as the CONF object. If we do need the context object, I wonder if we can separate the concerns here so that we\u0027re not requiring developers to pass this to the context manager every time they use it.","commit_id":"7e1e3686a6ecc1c9fd7e238561c3ad7a849ccdec"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"65b34acce9f353c9a94040d6cf63a69eddf38b3b","unresolved":false,"context_lines":[{"line_number":60,"context_line":"class Enforcer(object):"},{"line_number":61,"context_line":""},{"line_number":62,"context_line":"    def __init__(self, context, conf, claim, callback\u003dNone, verify\u003dTrue,"},{"line_number":63,"context_line":"                 session\u003dNone):"},{"line_number":64,"context_line":"        \"\"\"Context manager for checking usage against resource claims."},{"line_number":65,"context_line":""},{"line_number":66,"context_line":"        :param context: Request context."}],"source_content_type":"text/x-python","patch_set":5,"id":"3f79a3b5_32cec35b","line":63,"range":{"start_line":63,"start_character":17,"end_line":63,"end_character":24},"updated":"2018-08-29 15:41:11.000000000","message":"This could be something that we cache in the enforcer object instead of rebuilding it every time we invoke the context manager.","commit_id":"7e1e3686a6ecc1c9fd7e238561c3ad7a849ccdec"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"65b34acce9f353c9a94040d6cf63a69eddf38b3b","unresolved":false,"context_lines":[{"line_number":97,"context_line":"        if not session:"},{"line_number":98,"context_line":"            auth \u003d identity.Token("},{"line_number":99,"context_line":"                auth_url\u003dCONF.keystone_authtoken.auth_url,"},{"line_number":100,"context_line":"                token\u003dcontext.auth_token)"},{"line_number":101,"context_line":"            session \u003d ksa_loading.load_session_from_conf_options("},{"line_number":102,"context_line":"                conf, group\u003d\u0027oslo_limit\u0027, auth\u003dauth)"},{"line_number":103,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"3f79a3b5_72819bfb","line":100,"range":{"start_line":100,"start_character":22,"end_line":100,"end_character":40},"updated":"2018-08-29 15:41:11.000000000","message":"This is the user token, yeah? Can\u0027t we use a service token? If so, then we shouldn\u0027t need to have a dependency on a context object and we should be able to handle getting a token as the service user with the information available to us from the CONF object we already have.","commit_id":"7e1e3686a6ecc1c9fd7e238561c3ad7a849ccdec"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"65b34acce9f353c9a94040d6cf63a69eddf38b3b","unresolved":false,"context_lines":[{"line_number":104,"context_line":"        self.client \u003d ksc_client.Client(session\u003dsession)"},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"    def __enter__(self):"},{"line_number":107,"context_line":"        if self.callback is not None and self.verify:"},{"line_number":108,"context_line":"            limit \u003d self.client.limits.list("},{"line_number":109,"context_line":"                service\u003dself.conf.oslo_limit.service_id,"},{"line_number":110,"context_line":"                region\u003dself.conf.oslo_limit.region_id,"}],"source_content_type":"text/x-python","patch_set":5,"id":"3f79a3b5_720bdb7c","line":107,"range":{"start_line":107,"start_character":41,"end_line":107,"end_character":53},"updated":"2018-08-29 15:41:11.000000000","message":"I think this is going to have to to live in the __exit__() method. We should always be checking that the claim fits within the given limit from keystone when we enter the context manager. If that check fails, then the service doesn\u0027t need to do any more processing.\n\nThe self.verify property was specific to after the service executed the claim. The idea what to recalculate the usage after the claim was applied to make sure everything was still within the limit. For example, if request A makes a claim for 4 things and request B claimed 5 things right after A calculated usage, then total usage would be over the limit. Verification is needed after the claim is applied. In the case a race condition did put us in this state, then we\u0027ll need to raise the exception and clean up the resources.","commit_id":"7e1e3686a6ecc1c9fd7e238561c3ad7a849ccdec"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"65b34acce9f353c9a94040d6cf63a69eddf38b3b","unresolved":false,"context_lines":[{"line_number":104,"context_line":"        self.client \u003d ksc_client.Client(session\u003dsession)"},{"line_number":105,"context_line":""},{"line_number":106,"context_line":"    def __enter__(self):"},{"line_number":107,"context_line":"        if self.callback is not None and self.verify:"},{"line_number":108,"context_line":"            limit \u003d self.client.limits.list("},{"line_number":109,"context_line":"                service\u003dself.conf.oslo_limit.service_id,"},{"line_number":110,"context_line":"                region\u003dself.conf.oslo_limit.region_id,"}],"source_content_type":"text/x-python","patch_set":5,"id":"3f79a3b5_32f7a38f","line":107,"range":{"start_line":107,"start_character":8,"end_line":107,"end_character":36},"updated":"2018-08-29 15:41:11.000000000","message":"Looking at this implementation, I\u0027m wondering why I made the callback optional. Does it ever make sense to have this be optional?","commit_id":"7e1e3686a6ecc1c9fd7e238561c3ad7a849ccdec"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"ea907e58cd5d4ecec6cfdcb64bdaa92c9ca7423e","unresolved":false,"context_lines":[{"line_number":48,"context_line":""},{"line_number":49,"context_line":"class Enforcer(object):"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"    def __init__(self, claim, callback\u003dNone, verify\u003dTrue):"},{"line_number":52,"context_line":"        \"\"\"Context manager for checking usage against resource claims."},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"        :param claim: An object containing information about the claim."}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_7e7a3a88","side":"PARENT","line":51,"range":{"start_line":51,"start_character":30,"end_line":51,"end_character":43},"updated":"2018-09-05 16:13:02.000000000","message":"Technically, we could make this its own change since it doesn\u0027t have anything to do with the rest of this patch.","commit_id":"4c68c455ba0891b6c3c239f377f3a46fb662668f"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"a9a6c61fd6b985502b580f06c7bd013fd99822e7","unresolved":false,"context_lines":[{"line_number":48,"context_line":""},{"line_number":49,"context_line":"class Enforcer(object):"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"    def __init__(self, claim, callback\u003dNone, verify\u003dTrue):"},{"line_number":52,"context_line":"        \"\"\"Context manager for checking usage against resource claims."},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"        :param claim: An object containing information about the claim."}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_0b4ad825","side":"PARENT","line":51,"range":{"start_line":51,"start_character":30,"end_line":51,"end_character":43},"in_reply_to":"3f79a3b5_7e7a3a88","updated":"2018-09-06 07:25:23.000000000","message":"Done","commit_id":"4c68c455ba0891b6c3c239f377f3a46fb662668f"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"ea907e58cd5d4ecec6cfdcb64bdaa92c9ca7423e","unresolved":false,"context_lines":[{"line_number":32,"context_line":""},{"line_number":33,"context_line":"    if not KS_CLIENT:"},{"line_number":34,"context_line":"        if not session:"},{"line_number":35,"context_line":"            auth \u003d ksa_loading.load_auth_from_conf_options("},{"line_number":36,"context_line":"                CONF, group\u003d\u0027oslo_limit\u0027)"},{"line_number":37,"context_line":"            session \u003d ksa_loading.load_session_from_conf_options("},{"line_number":38,"context_line":"                CONF, group\u003d\u0027oslo_limit\u0027, auth\u003dauth)"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"        KS_CLIENT \u003d ksc_client.Client(session\u003dsession)"},{"line_number":41,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_3957fc03","line":38,"range":{"start_line":35,"start_character":12,"end_line":38,"end_character":52},"updated":"2018-09-05 16:13:02.000000000","message":"This appears to be causing some issues when running tests. Almost as if the auth section is getting nested in the oslo_limit config group. That might not be what we need here though.\n\nWe might just try looking in the CONF object to an auth_token section and reusing that to build auth and session objects. Otherwise we might be forcing deployers to duplicate information in two different sections of config.","commit_id":"5722b59eeb3dfe8f41eae3c874ecd64fe7c50ebc"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"a9a6c61fd6b985502b580f06c7bd013fd99822e7","unresolved":false,"context_lines":[{"line_number":32,"context_line":""},{"line_number":33,"context_line":"    if not KS_CLIENT:"},{"line_number":34,"context_line":"        if not session:"},{"line_number":35,"context_line":"            auth \u003d ksa_loading.load_auth_from_conf_options("},{"line_number":36,"context_line":"                CONF, group\u003d\u0027oslo_limit\u0027)"},{"line_number":37,"context_line":"            session \u003d ksa_loading.load_session_from_conf_options("},{"line_number":38,"context_line":"                CONF, group\u003d\u0027oslo_limit\u0027, auth\u003dauth)"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"        KS_CLIENT \u003d ksc_client.Client(session\u003dsession)"},{"line_number":41,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_ab8e442b","line":38,"range":{"start_line":35,"start_character":12,"end_line":38,"end_character":52},"in_reply_to":"3f79a3b5_3957fc03","updated":"2018-09-06 07:25:23.000000000","message":"Done","commit_id":"5722b59eeb3dfe8f41eae3c874ecd64fe7c50ebc"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"ea907e58cd5d4ecec6cfdcb64bdaa92c9ca7423e","unresolved":false,"context_lines":[{"line_number":75,"context_line":""},{"line_number":76,"context_line":"class Enforcer(object):"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":"    def __init__(self, claim, callback, verify\u003dTrue, session\u003dNone):"},{"line_number":79,"context_line":"        \"\"\"Context manager for checking usage against resource claims."},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"        :param claim: An object containing information about the claim."}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_5e5f3ee4","line":78,"range":{"start_line":78,"start_character":53,"end_line":78,"end_character":65},"updated":"2018-09-05 16:13:02.000000000","message":"I was just looking at some code in nova yesterday that supported optionally passing in session objects and I wonder how often it\u0027s actually used.\n\nMaybe for the sake of simplicity, we omit accepting a session object and just construct one internally to use, wait til someone comes calling for this functionality before we add it?","commit_id":"5722b59eeb3dfe8f41eae3c874ecd64fe7c50ebc"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"a9a6c61fd6b985502b580f06c7bd013fd99822e7","unresolved":false,"context_lines":[{"line_number":75,"context_line":""},{"line_number":76,"context_line":"class Enforcer(object):"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":"    def __init__(self, claim, callback, verify\u003dTrue, session\u003dNone):"},{"line_number":79,"context_line":"        \"\"\"Context manager for checking usage against resource claims."},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"        :param claim: An object containing information about the claim."}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_cbfdc0b2","line":78,"range":{"start_line":78,"start_character":53,"end_line":78,"end_character":65},"in_reply_to":"3f79a3b5_5e5f3ee4","updated":"2018-09-06 07:25:23.000000000","message":"yeah, I add it for the case if the service want its own session. We can git rid of it now and add it back if needed in the future.","commit_id":"5722b59eeb3dfe8f41eae3c874ecd64fe7c50ebc"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"ea907e58cd5d4ecec6cfdcb64bdaa92c9ca7423e","unresolved":false,"context_lines":[{"line_number":107,"context_line":"        self.verify \u003d verify"},{"line_number":108,"context_line":"        self.client \u003d get_keystone_client(session\u003dsession)"},{"line_number":109,"context_line":"        self.service_id, self.region_id \u003d self._get_service_region()"},{"line_number":110,"context_line":"        self.resource_limit \u003d None"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"    def __enter__(self):"},{"line_number":113,"context_line":"        if not self.resource_limit:"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_a3f8bd49","line":110,"range":{"start_line":110,"start_character":13,"end_line":110,"end_character":27},"updated":"2018-09-05 16:13:02.000000000","message":"We should document this in the constructor even though users can\u0027t invoke it via calling Enforcer directly.","commit_id":"5722b59eeb3dfe8f41eae3c874ecd64fe7c50ebc"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"2c6c866cecb76be476a80c5da9bee77740a5f0ac","unresolved":false,"context_lines":[{"line_number":107,"context_line":"        self.verify \u003d verify"},{"line_number":108,"context_line":"        self.client \u003d get_keystone_client(session\u003dsession)"},{"line_number":109,"context_line":"        self.service_id, self.region_id \u003d self._get_service_region()"},{"line_number":110,"context_line":"        self.resource_limit \u003d None"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"    def __enter__(self):"},{"line_number":113,"context_line":"        if not self.resource_limit:"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_cebcf9bc","line":110,"range":{"start_line":110,"start_character":13,"end_line":110,"end_character":27},"in_reply_to":"3f79a3b5_a3f8bd49","updated":"2018-09-05 20:11:12.000000000","message":"Actually - you can disregard this comment. After thinking about it I\u0027m not sure it makes sense because I don\u0027t think we do it elsewhere and I was under the assumption we did.","commit_id":"5722b59eeb3dfe8f41eae3c874ecd64fe7c50ebc"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"ea907e58cd5d4ecec6cfdcb64bdaa92c9ca7423e","unresolved":false,"context_lines":[{"line_number":118,"context_line":"        if self.verify:"},{"line_number":119,"context_line":"            self._verify(self.resource_limit)"},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"    # TODO(wxy): enable caching function."},{"line_number":122,"context_line":"    def _get_resource_limit(self):"},{"line_number":123,"context_line":"        limit \u003d self.client.limits.list("},{"line_number":124,"context_line":"            service\u003dself.service_id,"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_4383e9cb","line":121,"range":{"start_line":121,"start_character":4,"end_line":121,"end_character":41},"updated":"2018-09-05 16:13:02.000000000","message":"Good point. I think we should track this RFE formally. I added a bug report for it.\n\nhttps://bugs.launchpad.net/oslo.limit/+bug/1790894","commit_id":"5722b59eeb3dfe8f41eae3c874ecd64fe7c50ebc"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"a9a6c61fd6b985502b580f06c7bd013fd99822e7","unresolved":false,"context_lines":[{"line_number":118,"context_line":"        if self.verify:"},{"line_number":119,"context_line":"            self._verify(self.resource_limit)"},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"    # TODO(wxy): enable caching function."},{"line_number":122,"context_line":"    def _get_resource_limit(self):"},{"line_number":123,"context_line":"        limit \u003d self.client.limits.list("},{"line_number":124,"context_line":"            service\u003dself.service_id,"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_6b5a6cf2","line":121,"range":{"start_line":121,"start_character":4,"end_line":121,"end_character":41},"in_reply_to":"3f79a3b5_4383e9cb","updated":"2018-09-06 07:25:23.000000000","message":"Done","commit_id":"5722b59eeb3dfe8f41eae3c874ecd64fe7c50ebc"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"ea907e58cd5d4ecec6cfdcb64bdaa92c9ca7423e","unresolved":false,"context_lines":[{"line_number":132,"context_line":"                resource_name\u003dself.claim.resource_name)"},{"line_number":133,"context_line":"            if not limit:"},{"line_number":134,"context_line":"                raise exception.LimitNotFound(self.claim.resource_name)"},{"line_number":135,"context_line":"        return limit[0].get(\u0027resource_limit\u0027, limit[0].get(\u0027default_limit\u0027))"},{"line_number":136,"context_line":""},{"line_number":137,"context_line":"    # TODO(wxy): enable caching function."},{"line_number":138,"context_line":"    def _get_service_region(self):"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_23682df2","line":135,"range":{"start_line":135,"start_character":60,"end_line":135,"end_character":73},"updated":"2018-09-05 16:13:02.000000000","message":"If we\u0027re dealing with a project-specific limit, this line is going to always return None since project-specific limits don\u0027t have a \u0027default_limit\u0027 attribute. Right? Otherwise project-specific limits need to look for `limit` instead of `default_limit`.","commit_id":"5722b59eeb3dfe8f41eae3c874ecd64fe7c50ebc"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"a9a6c61fd6b985502b580f06c7bd013fd99822e7","unresolved":false,"context_lines":[{"line_number":132,"context_line":"                resource_name\u003dself.claim.resource_name)"},{"line_number":133,"context_line":"            if not limit:"},{"line_number":134,"context_line":"                raise exception.LimitNotFound(self.claim.resource_name)"},{"line_number":135,"context_line":"        return limit[0].get(\u0027resource_limit\u0027, limit[0].get(\u0027default_limit\u0027))"},{"line_number":136,"context_line":""},{"line_number":137,"context_line":"    # TODO(wxy): enable caching function."},{"line_number":138,"context_line":"    def _get_service_region(self):"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_cbc4e062","line":135,"range":{"start_line":135,"start_character":60,"end_line":135,"end_character":73},"in_reply_to":"3f79a3b5_23682df2","updated":"2018-09-06 07:25:23.000000000","message":"resource_limit is for project limit.\ndefault_limit is for registered limit.\n\nSo see L123-L132, we first try to get project limit, if None, we\u0027ll try to get registered limit. So limit at L135 may be either project limit or registered limit.","commit_id":"5722b59eeb3dfe8f41eae3c874ecd64fe7c50ebc"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"a97f479524aaad7ca107dde88ce4147ea6bed9aa","unresolved":false,"context_lines":[{"line_number":24,"context_line":"CONF \u003d cfg.CONF"},{"line_number":25,"context_line":"opts.register_opts(CONF)"},{"line_number":26,"context_line":""},{"line_number":27,"context_line":"KS_CLIENT \u003d None"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":""},{"line_number":30,"context_line":"def get_keystone_client():"}],"source_content_type":"text/x-python","patch_set":10,"id":"3f79a3b5_14fdc93a","line":27,"updated":"2018-09-10 18:26:46.000000000","message":"Do we want this to be public? It\u0027s only supposed to be retrieved via get_keystone_client, right? For that matter, does get_keystone_client need to be public? Is it intended to be used outside this file anywhere?","commit_id":"9e7b0272bb3555c3f61154befdf7d8f5636682d7"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"521d2351e63beb79ed9c882c096a9abfaa02ee49","unresolved":false,"context_lines":[{"line_number":24,"context_line":"CONF \u003d cfg.CONF"},{"line_number":25,"context_line":"opts.register_opts(CONF)"},{"line_number":26,"context_line":""},{"line_number":27,"context_line":"KS_CLIENT \u003d None"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":""},{"line_number":30,"context_line":"def get_keystone_client():"}],"source_content_type":"text/x-python","patch_set":10,"id":"3f79a3b5_001b3cca","line":27,"in_reply_to":"3f79a3b5_14fdc93a","updated":"2018-09-11 09:01:43.000000000","message":"it should be private.","commit_id":"9e7b0272bb3555c3f61154befdf7d8f5636682d7"},{"author":{"_account_id":2903,"name":"Morgan Fainberg","email":"morgan.fainberg@gmail.com","username":"mdrnstm"},"change_message_id":"b8bd064206596334f2cb586771c8c549ce9f3fad","unresolved":false,"context_lines":[{"line_number":31,"context_line":"    global KS_CLIENT"},{"line_number":32,"context_line":""},{"line_number":33,"context_line":"    if not KS_CLIENT:"},{"line_number":34,"context_line":"        auth \u003d ksa_loading.load_auth_from_conf_options("},{"line_number":35,"context_line":"            CONF, group\u003d\u0027keystone_authtoken\u0027)"},{"line_number":36,"context_line":"        session \u003d ksa_loading.load_session_from_conf_options("},{"line_number":37,"context_line":"            CONF, group\u003d\u0027oslo_limit\u0027, auth\u003dauth)"},{"line_number":38,"context_line":"        KS_CLIENT \u003d ksc_client.Client(session\u003dsession)"}],"source_content_type":"text/x-python","patch_set":10,"id":"3f79a3b5_fb9e0054","line":35,"range":{"start_line":34,"start_character":0,"end_line":35,"end_character":45},"updated":"2018-09-10 15:33:32.000000000","message":"Reason for a -1: Do not lean on the keystone authtoken configs for ANYTHING except for authtoken. This breaks the capability of changing authtoken without causing rippling problems through anything else.","commit_id":"9e7b0272bb3555c3f61154befdf7d8f5636682d7"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"521d2351e63beb79ed9c882c096a9abfaa02ee49","unresolved":false,"context_lines":[{"line_number":31,"context_line":"    global KS_CLIENT"},{"line_number":32,"context_line":""},{"line_number":33,"context_line":"    if not KS_CLIENT:"},{"line_number":34,"context_line":"        auth \u003d ksa_loading.load_auth_from_conf_options("},{"line_number":35,"context_line":"            CONF, group\u003d\u0027keystone_authtoken\u0027)"},{"line_number":36,"context_line":"        session \u003d ksa_loading.load_session_from_conf_options("},{"line_number":37,"context_line":"            CONF, group\u003d\u0027oslo_limit\u0027, auth\u003dauth)"},{"line_number":38,"context_line":"        KS_CLIENT \u003d ksc_client.Client(session\u003dsession)"}],"source_content_type":"text/x-python","patch_set":10,"id":"3f79a3b5_607f90df","line":35,"range":{"start_line":34,"start_character":0,"end_line":35,"end_character":45},"in_reply_to":"3f79a3b5_fb9e0054","updated":"2018-09-11 09:01:43.000000000","message":"correct, I\u0027d like to register some new options in [oslo_limit]","commit_id":"9e7b0272bb3555c3f61154befdf7d8f5636682d7"},{"author":{"_account_id":2903,"name":"Morgan Fainberg","email":"morgan.fainberg@gmail.com","username":"mdrnstm"},"change_message_id":"b8bd064206596334f2cb586771c8c549ce9f3fad","unresolved":false,"context_lines":[{"line_number":27,"context_line":"KS_CLIENT \u003d None"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":""},{"line_number":30,"context_line":"def get_keystone_client():"},{"line_number":31,"context_line":"    global KS_CLIENT"},{"line_number":32,"context_line":""},{"line_number":33,"context_line":"    if not KS_CLIENT:"},{"line_number":34,"context_line":"        auth \u003d ksa_loading.load_auth_from_conf_options("},{"line_number":35,"context_line":"            CONF, group\u003d\u0027keystone_authtoken\u0027)"},{"line_number":36,"context_line":"        session \u003d ksa_loading.load_session_from_conf_options("},{"line_number":37,"context_line":"            CONF, group\u003d\u0027oslo_limit\u0027, auth\u003dauth)"},{"line_number":38,"context_line":"        KS_CLIENT \u003d ksc_client.Client(session\u003dsession)"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    return KS_CLIENT"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":""},{"line_number":43,"context_line":"class ProjectClaim(object):"}],"source_content_type":"text/x-python","patch_set":10,"id":"3f79a3b5_bbef28b0","line":40,"range":{"start_line":30,"start_character":0,"end_line":40,"end_character":20},"updated":"2018-09-10 15:33:32.000000000","message":"There might be a better way than using a Global.","commit_id":"9e7b0272bb3555c3f61154befdf7d8f5636682d7"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"521d2351e63beb79ed9c882c096a9abfaa02ee49","unresolved":false,"context_lines":[{"line_number":27,"context_line":"KS_CLIENT \u003d None"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":""},{"line_number":30,"context_line":"def get_keystone_client():"},{"line_number":31,"context_line":"    global KS_CLIENT"},{"line_number":32,"context_line":""},{"line_number":33,"context_line":"    if not KS_CLIENT:"},{"line_number":34,"context_line":"        auth \u003d ksa_loading.load_auth_from_conf_options("},{"line_number":35,"context_line":"            CONF, group\u003d\u0027keystone_authtoken\u0027)"},{"line_number":36,"context_line":"        session \u003d ksa_loading.load_session_from_conf_options("},{"line_number":37,"context_line":"            CONF, group\u003d\u0027oslo_limit\u0027, auth\u003dauth)"},{"line_number":38,"context_line":"        KS_CLIENT \u003d ksc_client.Client(session\u003dsession)"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    return KS_CLIENT"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":""},{"line_number":43,"context_line":"class ProjectClaim(object):"}],"source_content_type":"text/x-python","patch_set":10,"id":"3f79a3b5_2d4e7038","line":40,"range":{"start_line":30,"start_character":0,"end_line":40,"end_character":20},"in_reply_to":"3f79a3b5_bbef28b0","updated":"2018-09-11 09:01:43.000000000","message":"Emm, any better suggestion? Using Global here is to avoid create multi client session.","commit_id":"9e7b0272bb3555c3f61154befdf7d8f5636682d7"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"a97f479524aaad7ca107dde88ce4147ea6bed9aa","unresolved":false,"context_lines":[{"line_number":102,"context_line":"        self.claim \u003d claim"},{"line_number":103,"context_line":"        self.callback \u003d callback"},{"line_number":104,"context_line":"        self.verify \u003d verify"},{"line_number":105,"context_line":"        self.client \u003d get_keystone_client()"},{"line_number":106,"context_line":"        self.service_id, self.region_id \u003d self._get_service_and_region()"},{"line_number":107,"context_line":"        self.resource_limit \u003d None"},{"line_number":108,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"3f79a3b5_0fd7f6c2","line":105,"updated":"2018-09-10 18:26:46.000000000","message":"And continuing my theme, should these be public? It\u0027s probably okay if someone modifies claim, callback, or verify since they\u0027re passed in from the caller in the first place, but the client, ids, and resource_limit should probably be internal. If someone messes around with them things could get confusing (say someone sets a bogus resource_limit).","commit_id":"9e7b0272bb3555c3f61154befdf7d8f5636682d7"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"521d2351e63beb79ed9c882c096a9abfaa02ee49","unresolved":false,"context_lines":[{"line_number":102,"context_line":"        self.claim \u003d claim"},{"line_number":103,"context_line":"        self.callback \u003d callback"},{"line_number":104,"context_line":"        self.verify \u003d verify"},{"line_number":105,"context_line":"        self.client \u003d get_keystone_client()"},{"line_number":106,"context_line":"        self.service_id, self.region_id \u003d self._get_service_and_region()"},{"line_number":107,"context_line":"        self.resource_limit \u003d None"},{"line_number":108,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"3f79a3b5_4d73ace9","line":105,"in_reply_to":"3f79a3b5_0fd7f6c2","updated":"2018-09-11 09:01:43.000000000","message":"yeah, they should be private.","commit_id":"9e7b0272bb3555c3f61154befdf7d8f5636682d7"},{"author":{"_account_id":2903,"name":"Morgan Fainberg","email":"morgan.fainberg@gmail.com","username":"mdrnstm"},"change_message_id":"549ec12870e3ea8ef2f385a12792fe808d39cff2","unresolved":false,"context_lines":[{"line_number":111,"context_line":"            self.resource_limit \u003d self._get_resource_limit()"},{"line_number":112,"context_line":"        self._verify(self.resource_limit)"},{"line_number":113,"context_line":""},{"line_number":114,"context_line":"    def __exit__(self, *args):"},{"line_number":115,"context_line":"        if self.verify:"},{"line_number":116,"context_line":"            self._verify(self.resource_limit)"},{"line_number":117,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"3f79a3b5_be69568d","line":114,"range":{"start_line":114,"start_character":3,"end_line":114,"end_character":29},"updated":"2018-09-10 15:53:08.000000000","message":"You\u0027re going to need to handle the extra arguments for exception cases in the context before __exit__ is called.","commit_id":"9e7b0272bb3555c3f61154befdf7d8f5636682d7"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"a97f479524aaad7ca107dde88ce4147ea6bed9aa","unresolved":false,"context_lines":[{"line_number":111,"context_line":"            self.resource_limit \u003d self._get_resource_limit()"},{"line_number":112,"context_line":"        self._verify(self.resource_limit)"},{"line_number":113,"context_line":""},{"line_number":114,"context_line":"    def __exit__(self, *args):"},{"line_number":115,"context_line":"        if self.verify:"},{"line_number":116,"context_line":"            self._verify(self.resource_limit)"},{"line_number":117,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"3f79a3b5_4f808ef8","line":114,"range":{"start_line":114,"start_character":3,"end_line":114,"end_character":29},"in_reply_to":"3f79a3b5_be69568d","updated":"2018-09-10 18:26:46.000000000","message":"*args will do that, at least enough to keep the interpreter happy. However, this won\u0027t do any exception handling, they\u0027ll just be propagated out. I think that\u0027s what we want though? The caller would be responsible for retrying any retryable errors, and any failure here would have happened outside oslo.limit\u0027s code so we probably don\u0027t want to mess with the exception.","commit_id":"9e7b0272bb3555c3f61154befdf7d8f5636682d7"},{"author":{"_account_id":2903,"name":"Morgan Fainberg","email":"morgan.fainberg@gmail.com","username":"mdrnstm"},"change_message_id":"72cd40cc8551c67fdf7f3579fe3fd2b37d316ebd","unresolved":false,"context_lines":[{"line_number":27,"context_line":"_KS_CLIENT \u003d None"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":""},{"line_number":30,"context_line":"def _get_keystone_client():"},{"line_number":31,"context_line":"    global _KS_CLIENT"},{"line_number":32,"context_line":""},{"line_number":33,"context_line":"    if not _KS_CLIENT:"},{"line_number":34,"context_line":"        auth \u003d ksa_loading.load_auth_from_conf_options("},{"line_number":35,"context_line":"            CONF, group\u003d\u0027oslo_limit\u0027)"},{"line_number":36,"context_line":"        session \u003d ksa_loading.load_session_from_conf_options("},{"line_number":37,"context_line":"            CONF, group\u003d\u0027oslo_limit\u0027, auth\u003dauth)"},{"line_number":38,"context_line":"        _KS_CLIENT \u003d ksc_client.Client(session\u003dsession)"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    return _KS_CLIENT"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":""},{"line_number":43,"context_line":"class ProjectClaim(object):"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_6db3360a","line":40,"range":{"start_line":30,"start_character":0,"end_line":40,"end_character":21},"updated":"2018-10-03 19:35:04.000000000","message":"Honestly, I really would rather see direct use of KSA than keystoneclient.\n\nI think it is almost 100% pointless to force use of ksc here, the URLs are known (and contracted). Eventually we will be able to move to SDK, but I think keeping that in mind now makes it easier.","commit_id":"9d4d5ec725c4c8a52de4207c50f82a4c82cbb9b6"},{"author":{"_account_id":2,"name":"Monty Taylor","email":"mordred@inaugust.com","username":"mordred"},"change_message_id":"e559379e88c150ffcac66ccf7f124c589d003d73","unresolved":false,"context_lines":[{"line_number":27,"context_line":"_KS_CLIENT \u003d None"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":""},{"line_number":30,"context_line":"def _get_keystone_client():"},{"line_number":31,"context_line":"    global _KS_CLIENT"},{"line_number":32,"context_line":""},{"line_number":33,"context_line":"    if not _KS_CLIENT:"},{"line_number":34,"context_line":"        auth \u003d ksa_loading.load_auth_from_conf_options("},{"line_number":35,"context_line":"            CONF, group\u003d\u0027oslo_limit\u0027)"},{"line_number":36,"context_line":"        session \u003d ksa_loading.load_session_from_conf_options("},{"line_number":37,"context_line":"            CONF, group\u003d\u0027oslo_limit\u0027, auth\u003dauth)"},{"line_number":38,"context_line":"        _KS_CLIENT \u003d ksc_client.Client(session\u003dsession)"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    return _KS_CLIENT"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":""},{"line_number":43,"context_line":"class ProjectClaim(object):"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_2d38de38","line":40,"range":{"start_line":30,"start_character":0,"end_line":40,"end_character":21},"in_reply_to":"3f79a3b5_6db3360a","updated":"2018-10-03 19:46:14.000000000","message":"Yes - I think SDK would be a good choice. Happy to add support for additional calls if we\u0027re missing something.","commit_id":"9d4d5ec725c4c8a52de4207c50f82a4c82cbb9b6"},{"author":{"_account_id":27621,"name":"Vishakha Agarwal","email":"agarwalvishakha18@gmail.com","username":"Vishakha"},"change_message_id":"75d8ed4f51aa62f729faa0620bb01b6a3a3a9d01","unresolved":false,"context_lines":[{"line_number":118,"context_line":"                self._verify(self._resource_limit)"},{"line_number":119,"context_line":""},{"line_number":120,"context_line":"    # FixMe(wxy): enable caching function. See bug 1790894"},{"line_number":121,"context_line":"    def _get_resource_limit(self):"},{"line_number":122,"context_line":"        limit \u003d self._client.limits.list("},{"line_number":123,"context_line":"            service\u003dself._service_id,"},{"line_number":124,"context_line":"            region\u003dself._region_id,"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_ca67acb8","line":121,"updated":"2018-10-05 02:27:23.000000000","message":"Can we also add some \u0027\u0027\u0027doc strings\u0027\u0027\u0027 for a little brief of this call to KSC for getting limits of a resource.","commit_id":"9d4d5ec725c4c8a52de4207c50f82a4c82cbb9b6"},{"author":{"_account_id":27621,"name":"Vishakha Agarwal","email":"agarwalvishakha18@gmail.com","username":"Vishakha"},"change_message_id":"75d8ed4f51aa62f729faa0620bb01b6a3a3a9d01","unresolved":false,"context_lines":[{"line_number":135,"context_line":""},{"line_number":136,"context_line":"    # FixMe(wxy): enable caching function. See bug 1790894"},{"line_number":137,"context_line":"    def _get_service_and_region(self):"},{"line_number":138,"context_line":"        endpoint_id \u003d CONF.oslo_limit.endpoint_id"},{"line_number":139,"context_line":"        endpoint \u003d self._client.endpoints.get(endpoint_id)"},{"line_number":140,"context_line":"        return endpoint[\u0027service_id\u0027], endpoint.get(\u0027region_id\u0027)"},{"line_number":141,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_4a787c7d","line":138,"updated":"2018-10-05 02:27:23.000000000","message":"I have a little doubt here that what endpoint_id will this variable CONF.oslo_limit.endpoint_id will contain? endpoint_id of oslo.limit?","commit_id":"9d4d5ec725c4c8a52de4207c50f82a4c82cbb9b6"},{"author":{"_account_id":27621,"name":"Vishakha Agarwal","email":"agarwalvishakha18@gmail.com","username":"Vishakha"},"change_message_id":"80d262e0a149b1baf13a79e0a4ac051ca1924027","unresolved":false,"context_lines":[{"line_number":31,"context_line":"    global _SDK_CONNECTION"},{"line_number":32,"context_line":""},{"line_number":33,"context_line":"    if not _SDK_CONNECTION:"},{"line_number":34,"context_line":"        auth \u003d ksa_loading.load_auth_from_conf_options("},{"line_number":35,"context_line":"            CONF, group\u003d\u0027oslo_limit\u0027)"},{"line_number":36,"context_line":"        session \u003d ksa_loading.load_session_from_conf_options("},{"line_number":37,"context_line":"            CONF, group\u003d\u0027oslo_limit\u0027, auth\u003dauth)"}],"source_content_type":"text/x-python","patch_set":16,"id":"3f79a3b5_fa86ef5f","line":34,"range":{"start_line":34,"start_character":8,"end_line":34,"end_character":12},"updated":"2018-10-31 04:05:43.000000000","message":"I think we can improve here a little bit.\n\nauth \u003d ksa_loading.load_auth_from_conf_option()\nif not auth:\n    LOG.warning(\u0027Unable to load auth from oslo_limit\u0027\n                            \u0027configuration.)\nreturn","commit_id":"234a666fb80b5f3fa87a25ad678a029d4733b9af"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"af81cb6471f50eb2c8ab5803090fb9df6362b9cf","unresolved":false,"context_lines":[{"line_number":31,"context_line":"    global _SDK_CONNECTION"},{"line_number":32,"context_line":""},{"line_number":33,"context_line":"    if not _SDK_CONNECTION:"},{"line_number":34,"context_line":"        auth \u003d ksa_loading.load_auth_from_conf_options("},{"line_number":35,"context_line":"            CONF, group\u003d\u0027oslo_limit\u0027)"},{"line_number":36,"context_line":"        session \u003d ksa_loading.load_session_from_conf_options("},{"line_number":37,"context_line":"            CONF, group\u003d\u0027oslo_limit\u0027, auth\u003dauth)"}],"source_content_type":"text/x-python","patch_set":16,"id":"3f79a3b5_75967040","line":34,"range":{"start_line":34,"start_character":8,"end_line":34,"end_character":12},"in_reply_to":"3f79a3b5_fa86ef5f","updated":"2018-10-31 06:59:11.000000000","message":"good point. exception can be better I think","commit_id":"234a666fb80b5f3fa87a25ad678a029d4733b9af"},{"author":{"_account_id":27621,"name":"Vishakha Agarwal","email":"agarwalvishakha18@gmail.com","username":"Vishakha"},"change_message_id":"80d262e0a149b1baf13a79e0a4ac051ca1924027","unresolved":false,"context_lines":[{"line_number":33,"context_line":"    if not _SDK_CONNECTION:"},{"line_number":34,"context_line":"        auth \u003d ksa_loading.load_auth_from_conf_options("},{"line_number":35,"context_line":"            CONF, group\u003d\u0027oslo_limit\u0027)"},{"line_number":36,"context_line":"        session \u003d ksa_loading.load_session_from_conf_options("},{"line_number":37,"context_line":"            CONF, group\u003d\u0027oslo_limit\u0027, auth\u003dauth)"},{"line_number":38,"context_line":"        _SDK_CONNECTION \u003d connection.Connection(session\u003dsession).identity"},{"line_number":39,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"3f79a3b5_5aeb6310","line":36,"updated":"2018-10-31 04:05:43.000000000","message":"Same for session.","commit_id":"234a666fb80b5f3fa87a25ad678a029d4733b9af"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"b81f15b98f83821c691189a40c72982cce412c07","unresolved":false,"context_lines":[{"line_number":39,"context_line":"            session \u003d ksa_loading.load_session_from_conf_options("},{"line_number":40,"context_line":"                CONF, group\u003d\u0027oslo_limit\u0027, auth\u003dauth)"},{"line_number":41,"context_line":"            _SDK_CONNECTION \u003d connection.Connection(session\u003dsession).identity"},{"line_number":42,"context_line":"        except Exception as e:"},{"line_number":43,"context_line":"            msg \u003d \"Can\u0027t initialise SDK session, reason: %s\" % e"},{"line_number":44,"context_line":"            LOG.error(msg)"},{"line_number":45,"context_line":"            raise exception.SessionInitError(e)"}],"source_content_type":"text/x-python","patch_set":19,"id":"3f79a3b5_bf8a5e62","line":42,"range":{"start_line":42,"start_character":15,"end_line":42,"end_character":24},"updated":"2018-11-02 22:02:44.000000000","message":"I\u0027m not *super* familiar with openstack-sdk, but I wouldn\u0027t mind digging into this a bit more to see if we can be specific in which exception we expect to handle here. Otherwise, this can cause strange issues if the exception from sdk isn\u0027t connection specific (which would be weird anyway, but...).","commit_id":"ec2688f438c8620977962ba88c5aa71ed66954a9"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"60f33bd685681ebf6d3e0fe2bfd691fb26a12daf","unresolved":false,"context_lines":[{"line_number":39,"context_line":"            session \u003d ksa_loading.load_session_from_conf_options("},{"line_number":40,"context_line":"                CONF, group\u003d\u0027oslo_limit\u0027, auth\u003dauth)"},{"line_number":41,"context_line":"            _SDK_CONNECTION \u003d connection.Connection(session\u003dsession).identity"},{"line_number":42,"context_line":"        except Exception as e:"},{"line_number":43,"context_line":"            msg \u003d \"Can\u0027t initialise SDK session, reason: %s\" % e"},{"line_number":44,"context_line":"            LOG.error(msg)"},{"line_number":45,"context_line":"            raise exception.SessionInitError(e)"}],"source_content_type":"text/x-python","patch_set":19,"id":"3f79a3b5_3b473455","line":42,"range":{"start_line":42,"start_character":15,"end_line":42,"end_character":24},"in_reply_to":"3f79a3b5_3f2e4ef9","updated":"2018-11-05 09:31:00.000000000","message":"Done, Added all the related exception I can hit.","commit_id":"ec2688f438c8620977962ba88c5aa71ed66954a9"},{"author":{"_account_id":2903,"name":"Morgan Fainberg","email":"morgan.fainberg@gmail.com","username":"mdrnstm"},"change_message_id":"faf542e38c7f3b7a7dbfbc898e9de77af185f4b6","unresolved":false,"context_lines":[{"line_number":39,"context_line":"            session \u003d ksa_loading.load_session_from_conf_options("},{"line_number":40,"context_line":"                CONF, group\u003d\u0027oslo_limit\u0027, auth\u003dauth)"},{"line_number":41,"context_line":"            _SDK_CONNECTION \u003d connection.Connection(session\u003dsession).identity"},{"line_number":42,"context_line":"        except Exception as e:"},{"line_number":43,"context_line":"            msg \u003d \"Can\u0027t initialise SDK session, reason: %s\" % e"},{"line_number":44,"context_line":"            LOG.error(msg)"},{"line_number":45,"context_line":"            raise exception.SessionInitError(e)"}],"source_content_type":"text/x-python","patch_set":19,"id":"3f79a3b5_3f2e4ef9","line":42,"range":{"start_line":42,"start_character":15,"end_line":42,"end_character":24},"in_reply_to":"3f79a3b5_bf8a5e62","updated":"2018-11-02 22:25:51.000000000","message":"This try/except also catches KSA errors. I too would like to see this more narrow than \"exception\". Also... does this indicate bandit is not run against oslo.limit? IIRC this should need a `# nosec` if bandit is running.","commit_id":"ec2688f438c8620977962ba88c5aa71ed66954a9"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"a418b514e3e72b14badb20dc44c5d15fddc8ea47","unresolved":false,"context_lines":[{"line_number":122,"context_line":"    def __exit__(self, exc_type, exc_val, exc_tb):"},{"line_number":123,"context_line":"        if not exc_val:"},{"line_number":124,"context_line":"            if self.verify:"},{"line_number":125,"context_line":"                self._verify(self._resource_limit)"},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"    # FixMe(wxy): enable caching function. See bug 1790894"},{"line_number":128,"context_line":"    def _get_resource_limit(self):"}],"source_content_type":"text/x-python","patch_set":19,"id":"3f79a3b5_02cf8426","line":125,"updated":"2018-11-02 16:47:01.000000000","message":"So I think this bit is wrong here, you don\u0027t want to add in self.claim.quantity here, that is not correct.\n\nNormally this is used after the resource appears in usage you get from the callback, so its just checking for races... I think we probably need to think about this a little differently.\n\nI am working on how to describe this problem better...","commit_id":"ec2688f438c8620977962ba88c5aa71ed66954a9"},{"author":{"_account_id":2903,"name":"Morgan Fainberg","email":"morgan.fainberg@gmail.com","username":"mdrnstm"},"change_message_id":"faf542e38c7f3b7a7dbfbc898e9de77af185f4b6","unresolved":false,"context_lines":[{"line_number":122,"context_line":"    def __exit__(self, exc_type, exc_val, exc_tb):"},{"line_number":123,"context_line":"        if not exc_val:"},{"line_number":124,"context_line":"            if self.verify:"},{"line_number":125,"context_line":"                self._verify(self._resource_limit)"},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"    # FixMe(wxy): enable caching function. See bug 1790894"},{"line_number":128,"context_line":"    def _get_resource_limit(self):"}],"source_content_type":"text/x-python","patch_set":19,"id":"3f79a3b5_df3cfa2e","line":125,"in_reply_to":"3f79a3b5_02cf8426","updated":"2018-11-02 22:25:51.000000000","message":"I look forward to your other words John.","commit_id":"ec2688f438c8620977962ba88c5aa71ed66954a9"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"d48e953e3c005f6f35d98219e569e66f6060b2de","unresolved":false,"context_lines":[{"line_number":122,"context_line":"    def __exit__(self, exc_type, exc_val, exc_tb):"},{"line_number":123,"context_line":"        if not exc_val:"},{"line_number":124,"context_line":"            if self.verify:"},{"line_number":125,"context_line":"                self._verify(self._resource_limit)"},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"    # FixMe(wxy): enable caching function. See bug 1790894"},{"line_number":128,"context_line":"    def _get_resource_limit(self):"}],"source_content_type":"text/x-python","patch_set":19,"id":"3f79a3b5_ec9ee4b5","line":125,"in_reply_to":"3f79a3b5_1b7b587a","updated":"2018-11-05 10:07:39.000000000","message":"This is a copy of what I put over here, it kinda applies to both changes:\nhttps://review.openstack.org/#/c/600266\n\nI have worked through this a bit more on the Nova side. Two things I think we should consider...\n\n1) I think we actually are unlikely to use the context manager. Basically our re-check is done by a separate process (currently). Not saying we should not include a context manager, I am only saying Nova needs a more basic direct interface (ideally).\n\n2) Most important bit is there is a single callback call to get *all* usages for the various resource_names. Reason, we only want to fetch all the users instances from the DB once (well actually we are trying to use placement instead, but same thing applies with that approach).\n\nAttempted to sketch it out here:\nhttps://github.com/JohnGarbutt/oslo.limit/blob/0d6fa80ab5548af3ed5beda96ba381f0eddf8fdd/oslo_limit/limit.py#L107\n\nAnd link it back to Nova code here:\nhttps://review.openstack.org/#/c/615180\n\nHonestly, the hacking around I did above was really just moving the code around a bit, rather than creating anything new.\n\nMy gut tells me we probably should think about trying something like this approach:\n\n* Define the callback interface carefully, so it deals with multiple resources being counted in a single callback (i.e. return a dict of resource_name and usage, get passed a list of resource_names that need checking).\n\n* Add the simplest possible \"check\" method to compare the +1 request for several resources (like +1 cpu, +64 ram), make it also work for something like (+0 cpu, +0 ram) so it just checks the current usage\n\n* Look at a nice context manager re-check approach, if needed by other projects\n\n* We think about how CLI tools can consume this library so users can compare their usage across all projects.","commit_id":"ec2688f438c8620977962ba88c5aa71ed66954a9"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"60f33bd685681ebf6d3e0fe2bfd691fb26a12daf","unresolved":false,"context_lines":[{"line_number":122,"context_line":"    def __exit__(self, exc_type, exc_val, exc_tb):"},{"line_number":123,"context_line":"        if not exc_val:"},{"line_number":124,"context_line":"            if self.verify:"},{"line_number":125,"context_line":"                self._verify(self._resource_limit)"},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"    # FixMe(wxy): enable caching function. See bug 1790894"},{"line_number":128,"context_line":"    def _get_resource_limit(self):"}],"source_content_type":"text/x-python","patch_set":19,"id":"3f79a3b5_1b7b587a","line":125,"in_reply_to":"3f79a3b5_df3cfa2e","updated":"2018-11-05 09:31:00.000000000","message":"ah, correct. will fix it.","commit_id":"ec2688f438c8620977962ba88c5aa71ed66954a9"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"785ff89963d796dc0d8f5c601303192a3a718f22","unresolved":false,"context_lines":[{"line_number":122,"context_line":"    def __exit__(self, exc_type, exc_val, exc_tb):"},{"line_number":123,"context_line":"        if not exc_val:"},{"line_number":124,"context_line":"            if self.verify:"},{"line_number":125,"context_line":"                self._verify(self._resource_limit)"},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"    # FixMe(wxy): enable caching function. See bug 1790894"},{"line_number":128,"context_line":"    def _get_resource_limit(self):"}],"source_content_type":"text/x-python","patch_set":19,"id":"3f79a3b5_41fc7ab5","line":125,"in_reply_to":"3f79a3b5_ec9ee4b5","updated":"2018-11-05 14:51:23.000000000","message":"\u003e This is a copy of what I put over here, it kinda applies to both\n \u003e changes:\n \u003e https://review.openstack.org/#/c/600266\n \u003e \n \u003e I have worked through this a bit more on the Nova side. Two things\n \u003e I think we should consider...\n \u003e \n \u003e 1) I think we actually are unlikely to use the context manager.\n \u003e Basically our re-check is done by a separate process (currently).\n \u003e Not saying we should not include a context manager, I am only\n \u003e saying Nova needs a more basic direct interface (ideally).\n\nDoes this mean you would only use the __enter__ functionality of the context manager and not verify at all?\n\n \u003e \n \u003e 2) Most important bit is there is a single callback call to get\n \u003e *all* usages for the various resource_names. Reason, we only want\n \u003e to fetch all the users instances from the DB once (well actually we\n \u003e are trying to use placement instead, but same thing applies with\n \u003e that approach).\n \u003e \n \u003e Attempted to sketch it out here:\n \u003e https://github.com/JohnGarbutt/oslo.limit/blob/0d6fa80ab5548af3ed5beda96ba381f0eddf8fdd/oslo_limit/limit.py#L107\n \u003e \n \u003e And link it back to Nova code here:\n \u003e https://review.openstack.org/#/c/615180\n \u003e \n \u003e Honestly, the hacking around I did above was really just moving the\n \u003e code around a bit, rather than creating anything new.\n \u003e \n \u003e My gut tells me we probably should think about trying something\n \u003e like this approach:\n \u003e \n \u003e * Define the callback interface carefully, so it deals with\n \u003e multiple resources being counted in a single callback (i.e. return\n \u003e a dict of resource_name and usage, get passed a list of\n \u003e resource_names that need checking).\n \u003e \n \u003e * Add the simplest possible \"check\" method to compare the +1\n \u003e request for several resources (like +1 cpu, +64 ram), make it also\n \u003e work for something like (+0 cpu, +0 ram) so it just checks the\n \u003e current usage\n \u003e \n \u003e * Look at a nice context manager re-check approach, if needed by\n \u003e other projects\n \u003e \n \u003e * We think about how CLI tools can consume this library so users\n \u003e can compare their usage across all projects.","commit_id":"ec2688f438c8620977962ba88c5aa71ed66954a9"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"b81f15b98f83821c691189a40c72982cce412c07","unresolved":false,"context_lines":[{"line_number":134,"context_line":"            service_id\u003dself._service_id,"},{"line_number":135,"context_line":"            region_id\u003dself._region_id,"},{"line_number":136,"context_line":"            resource_name\u003dself.claim.resource_name,"},{"line_number":137,"context_line":"            project_id\u003dself.claim.project_id)"},{"line_number":138,"context_line":"        try:"},{"line_number":139,"context_line":"            project_limit \u003d next(limit)"},{"line_number":140,"context_line":"            return project_limit.resource_limit"}],"source_content_type":"text/x-python","patch_set":19,"id":"3f79a3b5_5fef8a1b","line":137,"updated":"2018-11-02 22:02:44.000000000","message":"Nice - thanks for reworking this to use skd :)","commit_id":"ec2688f438c8620977962ba88c5aa71ed66954a9"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"b81f15b98f83821c691189a40c72982cce412c07","unresolved":false,"context_lines":[{"line_number":138,"context_line":"        try:"},{"line_number":139,"context_line":"            project_limit \u003d next(limit)"},{"line_number":140,"context_line":"            return project_limit.resource_limit"},{"line_number":141,"context_line":"        except StopIteration:"},{"line_number":142,"context_line":"            limit \u003d self._connection.registered_limits("},{"line_number":143,"context_line":"                service_id\u003dself._service_id,"},{"line_number":144,"context_line":"                region_id\u003dself._region_id,"}],"source_content_type":"text/x-python","patch_set":19,"id":"3f79a3b5_ff43f610","line":141,"range":{"start_line":141,"start_character":15,"end_line":141,"end_character":28},"updated":"2018-11-02 22:02:44.000000000","message":"We could improve readability here by introducing a couple of methods that inspect the `limit` variable to determine what it is based on the attributes.\n\n  if self._is_project_limit(limit):\n      return limit.resource_limit\n  elif self._is_registered_limit(limit):\n      return limit.default_limit\n  else:\n      # raise some sort of exception?","commit_id":"ec2688f438c8620977962ba88c5aa71ed66954a9"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"60f33bd685681ebf6d3e0fe2bfd691fb26a12daf","unresolved":false,"context_lines":[{"line_number":138,"context_line":"        try:"},{"line_number":139,"context_line":"            project_limit \u003d next(limit)"},{"line_number":140,"context_line":"            return project_limit.resource_limit"},{"line_number":141,"context_line":"        except StopIteration:"},{"line_number":142,"context_line":"            limit \u003d self._connection.registered_limits("},{"line_number":143,"context_line":"                service_id\u003dself._service_id,"},{"line_number":144,"context_line":"                region_id\u003dself._region_id,"}],"source_content_type":"text/x-python","patch_set":19,"id":"3f79a3b5_d66b75eb","line":141,"range":{"start_line":141,"start_character":15,"end_line":141,"end_character":28},"in_reply_to":"3f79a3b5_ff20d6fb","updated":"2018-11-05 09:31:00.000000000","message":"Done","commit_id":"ec2688f438c8620977962ba88c5aa71ed66954a9"},{"author":{"_account_id":2903,"name":"Morgan Fainberg","email":"morgan.fainberg@gmail.com","username":"mdrnstm"},"change_message_id":"faf542e38c7f3b7a7dbfbc898e9de77af185f4b6","unresolved":false,"context_lines":[{"line_number":138,"context_line":"        try:"},{"line_number":139,"context_line":"            project_limit \u003d next(limit)"},{"line_number":140,"context_line":"            return project_limit.resource_limit"},{"line_number":141,"context_line":"        except StopIteration:"},{"line_number":142,"context_line":"            limit \u003d self._connection.registered_limits("},{"line_number":143,"context_line":"                service_id\u003dself._service_id,"},{"line_number":144,"context_line":"                region_id\u003dself._region_id,"}],"source_content_type":"text/x-python","patch_set":19,"id":"3f79a3b5_ff20d6fb","line":141,"range":{"start_line":141,"start_character":15,"end_line":141,"end_character":28},"in_reply_to":"3f79a3b5_ff43f610","updated":"2018-11-02 22:25:51.000000000","message":"Maybe?","commit_id":"ec2688f438c8620977962ba88c5aa71ed66954a9"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"99479b4831c37fddaa013d4c3843f56f7c71978d","unresolved":false,"context_lines":[{"line_number":158,"context_line":"        return endpoint.service_id, endpoint.region_id"},{"line_number":159,"context_line":""},{"line_number":160,"context_line":"    def _verify(self, limit):"},{"line_number":161,"context_line":"        usage \u003d self.callback(self.claim.project_id)"},{"line_number":162,"context_line":"        quantity \u003d self.claim.quantity"},{"line_number":163,"context_line":"        if usage + quantity \u003e limit:"},{"line_number":164,"context_line":"            raise exception.ClaimExceedsLimit(usage, quantity, limit,"}],"source_content_type":"text/x-python","patch_set":19,"id":"3f79a3b5_743076b8","line":161,"updated":"2018-11-02 15:27:40.000000000","message":"So I was expecting the callback to be given and idea of what usage it is counting, like claim.resource_name (ideally a list of resource name, but that is a separate change)\n\nI think thinking the callback would be something like count_dynamic_limits in here:\nhttps://review.openstack.org/#/c/615180/3/nova/limit.py","commit_id":"ec2688f438c8620977962ba88c5aa71ed66954a9"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"a1173c0d8a1045c8da9374a2633a28cbfcf880f1","unresolved":false,"context_lines":[{"line_number":158,"context_line":"        return endpoint.service_id, endpoint.region_id"},{"line_number":159,"context_line":""},{"line_number":160,"context_line":"    def _verify(self, limit):"},{"line_number":161,"context_line":"        usage \u003d self.callback(self.claim.project_id)"},{"line_number":162,"context_line":"        quantity \u003d self.claim.quantity"},{"line_number":163,"context_line":"        if usage + quantity \u003e limit:"},{"line_number":164,"context_line":"            raise exception.ClaimExceedsLimit(usage, quantity, limit,"}],"source_content_type":"text/x-python","patch_set":19,"id":"3f79a3b5_d774eccf","line":161,"in_reply_to":"3f79a3b5_743076b8","updated":"2018-11-02 16:19:13.000000000","message":"I was thinking something like this:\nhttps://github.com/JohnGarbutt/oslo.limit/commit/81dc3b7dfd8e91bae17d30e5e7e1e2f8c5b92ae1","commit_id":"ec2688f438c8620977962ba88c5aa71ed66954a9"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"60f33bd685681ebf6d3e0fe2bfd691fb26a12daf","unresolved":false,"context_lines":[{"line_number":158,"context_line":"        return endpoint.service_id, endpoint.region_id"},{"line_number":159,"context_line":""},{"line_number":160,"context_line":"    def _verify(self, limit):"},{"line_number":161,"context_line":"        usage \u003d self.callback(self.claim.project_id)"},{"line_number":162,"context_line":"        quantity \u003d self.claim.quantity"},{"line_number":163,"context_line":"        if usage + quantity \u003e limit:"},{"line_number":164,"context_line":"            raise exception.ClaimExceedsLimit(usage, quantity, limit,"}],"source_content_type":"text/x-python","patch_set":19,"id":"3f79a3b5_31475355","line":161,"in_reply_to":"3f79a3b5_7f72861a","updated":"2018-11-05 09:31:00.000000000","message":"Multi resources support is done in another patch by Lance. I\u0027ll just add single support in this patch","commit_id":"ec2688f438c8620977962ba88c5aa71ed66954a9"},{"author":{"_account_id":2903,"name":"Morgan Fainberg","email":"morgan.fainberg@gmail.com","username":"mdrnstm"},"change_message_id":"faf542e38c7f3b7a7dbfbc898e9de77af185f4b6","unresolved":false,"context_lines":[{"line_number":158,"context_line":"        return endpoint.service_id, endpoint.region_id"},{"line_number":159,"context_line":""},{"line_number":160,"context_line":"    def _verify(self, limit):"},{"line_number":161,"context_line":"        usage \u003d self.callback(self.claim.project_id)"},{"line_number":162,"context_line":"        quantity \u003d self.claim.quantity"},{"line_number":163,"context_line":"        if usage + quantity \u003e limit:"},{"line_number":164,"context_line":"            raise exception.ClaimExceedsLimit(usage, quantity, limit,"}],"source_content_type":"text/x-python","patch_set":19,"id":"3f79a3b5_7f72861a","line":161,"in_reply_to":"3f79a3b5_9f01a2b7","updated":"2018-11-02 22:25:51.000000000","message":"Ultimately, yes. We should keep service specifics out of oslo.limit as much as possible.","commit_id":"ec2688f438c8620977962ba88c5aa71ed66954a9"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"b81f15b98f83821c691189a40c72982cce412c07","unresolved":false,"context_lines":[{"line_number":158,"context_line":"        return endpoint.service_id, endpoint.region_id"},{"line_number":159,"context_line":""},{"line_number":160,"context_line":"    def _verify(self, limit):"},{"line_number":161,"context_line":"        usage \u003d self.callback(self.claim.project_id)"},{"line_number":162,"context_line":"        quantity \u003d self.claim.quantity"},{"line_number":163,"context_line":"        if usage + quantity \u003e limit:"},{"line_number":164,"context_line":"            raise exception.ClaimExceedsLimit(usage, quantity, limit,"}],"source_content_type":"text/x-python","patch_set":19,"id":"3f79a3b5_9f01a2b7","line":161,"in_reply_to":"3f79a3b5_d774eccf","updated":"2018-11-02 22:02:44.000000000","message":"Looks like the advantage of this is that it would give the service the power to verify races while keeping service specifics out of oslo.limit?","commit_id":"ec2688f438c8620977962ba88c5aa71ed66954a9"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"a3778e317296a22f47fdf72b8340cdf65ecc0b2f","unresolved":false,"context_lines":[{"line_number":175,"context_line":"        return endpoint.service_id, endpoint.region_id"},{"line_number":176,"context_line":""},{"line_number":177,"context_line":"    def _verify(self, limit):"},{"line_number":178,"context_line":"        \"\"\"Make sure the claimed resources won\u0027t exceed current limit\"\"\""},{"line_number":179,"context_line":"        usage \u003d self.callback(self.claim.project_id, self.claim.resource_name)"},{"line_number":180,"context_line":"        quantity \u003d self.claim.quantity"},{"line_number":181,"context_line":"        if usage + quantity \u003e limit:"}],"source_content_type":"text/x-python","patch_set":20,"id":"3f79a3b5_81c9327b","line":178,"range":{"start_line":178,"start_character":64,"end_line":178,"end_character":69},"updated":"2018-11-05 14:56:29.000000000","message":"nit: add a period to be consistent with other usage in this module.","commit_id":"916fdc9d79b169400c814391330d02933c2f5cf7"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"a3778e317296a22f47fdf72b8340cdf65ecc0b2f","unresolved":false,"context_lines":[{"line_number":178,"context_line":"        \"\"\"Make sure the claimed resources won\u0027t exceed current limit\"\"\""},{"line_number":179,"context_line":"        usage \u003d self.callback(self.claim.project_id, self.claim.resource_name)"},{"line_number":180,"context_line":"        quantity \u003d self.claim.quantity"},{"line_number":181,"context_line":"        if usage + quantity \u003e limit:"},{"line_number":182,"context_line":"            raise exception.ClaimExceedsLimit(usage, quantity, limit,"},{"line_number":183,"context_line":"                                              self.claim.resource_name)"},{"line_number":184,"context_line":""}],"source_content_type":"text/x-python","patch_set":20,"id":"3f79a3b5_c17dea1e","line":181,"range":{"start_line":181,"start_character":19,"end_line":181,"end_character":27},"updated":"2018-11-05 14:56:29.000000000","message":"based on John\u0027s comments, this might actually be coming back as a dictionary of things, which means we might have to access the actual quantity we want using:\n\n  if usage + quantity[self.claim.resource_name] \u003e limit","commit_id":"916fdc9d79b169400c814391330d02933c2f5cf7"}],"oslo_limit/tests/test_limit.py":[{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"ea907e58cd5d4ecec6cfdcb64bdaa92c9ca7423e","unresolved":false,"context_lines":[{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    def test_optional_parameters(self):"},{"line_number":118,"context_line":"        callback \u003d self._get_usage_for_project"},{"line_number":119,"context_line":"        enforcer \u003d limit.Enforcer(self.claim, callback\u003dcallback, verify\u003dTrue)"},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"        self.assertEqual(self.claim, enforcer.claim)"},{"line_number":122,"context_line":"        self.assertEqual(self._get_usage_for_project, enforcer.callback)"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_1ed8e64f","side":"PARENT","line":119,"range":{"start_line":119,"start_character":55,"end_line":119,"end_character":63},"updated":"2018-09-05 16:13:02.000000000","message":"Same comment here as in the previous module.","commit_id":"4c68c455ba0891b6c3c239f377f3a46fb662668f"},{"author":{"_account_id":15054,"name":"wangxiyuan","email":"wangxiyuan1007@gmail.com","username":"wangxiyuan"},"change_message_id":"a9a6c61fd6b985502b580f06c7bd013fd99822e7","unresolved":false,"context_lines":[{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    def test_optional_parameters(self):"},{"line_number":118,"context_line":"        callback \u003d self._get_usage_for_project"},{"line_number":119,"context_line":"        enforcer \u003d limit.Enforcer(self.claim, callback\u003dcallback, verify\u003dTrue)"},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"        self.assertEqual(self.claim, enforcer.claim)"},{"line_number":122,"context_line":"        self.assertEqual(self._get_usage_for_project, enforcer.callback)"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_ebc19c4f","side":"PARENT","line":119,"range":{"start_line":119,"start_character":55,"end_line":119,"end_character":63},"in_reply_to":"3f79a3b5_1ed8e64f","updated":"2018-09-06 07:25:23.000000000","message":"Done","commit_id":"4c68c455ba0891b6c3c239f377f3a46fb662668f"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"ea907e58cd5d4ecec6cfdcb64bdaa92c9ca7423e","unresolved":false,"context_lines":[{"line_number":159,"context_line":"            )"},{"line_number":160,"context_line":""},{"line_number":161,"context_line":"    @mock.patch(\u0027keystoneclient.client.Client\u0027)"},{"line_number":162,"context_line":"    def test_call_enforce_success(self, mock_client):"},{"line_number":163,"context_line":"        callback \u003d self._get_usage_for_project"},{"line_number":164,"context_line":"        enforcer \u003d limit.Enforcer(self.claim, callback, verify\u003dTrue)"},{"line_number":165,"context_line":"        enforcer.client.limits.list.return_value \u003d [{\u0027resource_limit\u0027: 20}]"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_3eb602fb","line":162,"range":{"start_line":162,"start_character":40,"end_line":162,"end_character":51},"updated":"2018-09-05 16:13:02.000000000","message":"We might not actually need to define this here if we\u0027re not using it in the test.","commit_id":"5722b59eeb3dfe8f41eae3c874ecd64fe7c50ebc"},{"author":{"_account_id":27621,"name":"Vishakha Agarwal","email":"agarwalvishakha18@gmail.com","username":"Vishakha"},"change_message_id":"75d8ed4f51aa62f729faa0620bb01b6a3a3a9d01","unresolved":false,"context_lines":[{"line_number":235,"context_line":"        # will be called 1 times in __enter__."},{"line_number":236,"context_line":"        self.assertEqual(1, enforcer._verify.call_count)"},{"line_number":237,"context_line":""},{"line_number":238,"context_line":"    def test_call_verify_times_if_raiseing_error(self):"},{"line_number":239,"context_line":"        callback \u003d self._get_usage_for_project"},{"line_number":240,"context_line":"        enforcer \u003d limit.Enforcer(self.claim, callback, verify\u003dTrue)"},{"line_number":241,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_6aaa1885","line":238,"updated":"2018-10-05 02:27:23.000000000","message":"typo: raising","commit_id":"9d4d5ec725c4c8a52de4207c50f82a4c82cbb9b6"}],"test-requirements.txt":[{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"ea907e58cd5d4ecec6cfdcb64bdaa92c9ca7423e","unresolved":false,"context_lines":[{"line_number":3,"context_line":"# process, which may cause wedges in the gate later."},{"line_number":4,"context_line":""},{"line_number":5,"context_line":"hacking!\u003d0.13.0,\u003c0.14,\u003e\u003d0.12.0 # Apache-2.0"},{"line_number":6,"context_line":"oslo.context\u003e\u003d2.21.0 # Apache-2.0"},{"line_number":7,"context_line":"oslotest\u003e\u003d3.2.0 # Apache-2.0"},{"line_number":8,"context_line":"stestr\u003e\u003d1.0.0 # Apache-2.0"},{"line_number":9,"context_line":""}],"source_content_type":"text/plain","patch_set":6,"id":"3f79a3b5_79ed7423","line":6,"range":{"start_line":6,"start_character":0,"end_line":6,"end_character":33},"updated":"2018-09-05 16:13:02.000000000","message":"This could be removed, it looks like it\u0027s carry over from the last patchset.","commit_id":"5722b59eeb3dfe8f41eae3c874ecd64fe7c50ebc"}]}
