)]}'
{"oslo_privsep/comm.py":[{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"6bed96f05363828575933e20d6903f3291adfea7","unresolved":true,"context_lines":[{"line_number":36,"context_line":""},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"try:"},{"line_number":39,"context_line":"    import greenlet"},{"line_number":40,"context_line":""},{"line_number":41,"context_line":"    def _get_thread_ident():"},{"line_number":42,"context_line":"        # This returns something sensible, even if the current thread"},{"line_number":43,"context_line":"        # isn\u0027t a greenthread"},{"line_number":44,"context_line":"        return id(greenlet.getcurrent())"},{"line_number":45,"context_line":""},{"line_number":46,"context_line":"except ImportError:"},{"line_number":47,"context_line":"    def _get_thread_ident():"},{"line_number":48,"context_line":"        return threading.current_thread().ident"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"@enum.unique"}],"source_content_type":"text/x-python","patch_set":3,"id":"0225b343_396d9117","line":48,"range":{"start_line":39,"start_character":2,"end_line":48,"end_character":19},"updated":"2021-06-10 17:31:35.000000000","message":"Not necessary anymore.","commit_id":"f20a5b820fa424f5338ca970c0c0fb3e18cea9cf"},{"author":{"_account_id":8313,"name":"Lajos Katona","display_name":"lajoskatona","email":"katonalala@gmail.com","username":"elajkat","status":"Ericsson Software Technology"},"change_message_id":"ad2040112e9e9ca1a22142c3b5e1a41573d5fa79","unresolved":true,"context_lines":[{"line_number":36,"context_line":""},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"try:"},{"line_number":39,"context_line":"    import greenlet"},{"line_number":40,"context_line":""},{"line_number":41,"context_line":"    def _get_thread_ident():"},{"line_number":42,"context_line":"        # This returns something sensible, even if the current thread"},{"line_number":43,"context_line":"        # isn\u0027t a greenthread"},{"line_number":44,"context_line":"        return id(greenlet.getcurrent())"},{"line_number":45,"context_line":""},{"line_number":46,"context_line":"except ImportError:"},{"line_number":47,"context_line":"    def _get_thread_ident():"},{"line_number":48,"context_line":"        return threading.current_thread().ident"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"@enum.unique"}],"source_content_type":"text/x-python","patch_set":3,"id":"1eab740a_50944c9d","line":48,"range":{"start_line":39,"start_character":2,"end_line":48,"end_character":19},"in_reply_to":"0225b343_396d9117","updated":"2021-06-11 10:18:24.000000000","message":"thanks, You are right","commit_id":"f20a5b820fa424f5338ca970c0c0fb3e18cea9cf"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"6bed96f05363828575933e20d6903f3291adfea7","unresolved":true,"context_lines":[{"line_number":186,"context_line":"        pass"},{"line_number":187,"context_line":""},{"line_number":188,"context_line":"    def send_recv(self, msg, timeout\u003dNone):"},{"line_number":189,"context_line":"        myid \u003d uuidutils.generate_uuid()"},{"line_number":190,"context_line":"        future \u003d Future(self.lock, timeout)"},{"line_number":191,"context_line":""},{"line_number":192,"context_line":"        with self.lock:"}],"source_content_type":"text/x-python","patch_set":3,"id":"3885c051_d58b5279","line":189,"range":{"start_line":189,"start_character":25,"end_line":189,"end_character":38},"updated":"2021-06-10 17:31:35.000000000","message":"Why that? Don\u0027t get me wrong, I prefer this implementation.","commit_id":"f20a5b820fa424f5338ca970c0c0fb3e18cea9cf"},{"author":{"_account_id":8313,"name":"Lajos Katona","display_name":"lajoskatona","email":"katonalala@gmail.com","username":"elajkat","status":"Ericsson Software Technology"},"change_message_id":"ad2040112e9e9ca1a22142c3b5e1a41573d5fa79","unresolved":true,"context_lines":[{"line_number":186,"context_line":"        pass"},{"line_number":187,"context_line":""},{"line_number":188,"context_line":"    def send_recv(self, msg, timeout\u003dNone):"},{"line_number":189,"context_line":"        myid \u003d uuidutils.generate_uuid()"},{"line_number":190,"context_line":"        future \u003d Future(self.lock, timeout)"},{"line_number":191,"context_line":""},{"line_number":192,"context_line":"        with self.lock:"}],"source_content_type":"text/x-python","patch_set":3,"id":"af6ef501_6f788789","line":189,"range":{"start_line":189,"start_character":25,"end_line":189,"end_character":38},"in_reply_to":"32cdf8d6_c518f467","updated":"2021-06-11 10:18:24.000000000","message":"+1","commit_id":"f20a5b820fa424f5338ca970c0c0fb3e18cea9cf"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"971fb3a6409be3feb8a3e7924d7a3aec7e424d04","unresolved":true,"context_lines":[{"line_number":186,"context_line":"        pass"},{"line_number":187,"context_line":""},{"line_number":188,"context_line":"    def send_recv(self, msg, timeout\u003dNone):"},{"line_number":189,"context_line":"        myid \u003d uuidutils.generate_uuid()"},{"line_number":190,"context_line":"        future \u003d Future(self.lock, timeout)"},{"line_number":191,"context_line":""},{"line_number":192,"context_line":"        with self.lock:"}],"source_content_type":"text/x-python","patch_set":3,"id":"32cdf8d6_c518f467","line":189,"range":{"start_line":189,"start_character":25,"end_line":189,"end_character":38},"in_reply_to":"3885c051_d58b5279","updated":"2021-06-10 17:37:45.000000000","message":"Hold on, I know why: if one thread ends in the client side (Neutron) without any reply from the daemon side, we can eventually receive an unexpected reply if that thread in the daemon ends, matching _get_thread_ident(). We need to generate a new UUID per call, totally independent from the other.","commit_id":"f20a5b820fa424f5338ca970c0c0fb3e18cea9cf"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"971fb3a6409be3feb8a3e7924d7a3aec7e424d04","unresolved":true,"context_lines":[{"line_number":191,"context_line":""},{"line_number":192,"context_line":"        with self.lock:"},{"line_number":193,"context_line":"            if myid in self.outstanding_msgs:"},{"line_number":194,"context_line":"                raise AssertionError(\"myid shoudn\u0027t be in outstanding_msgs.\")"},{"line_number":195,"context_line":"            self.outstanding_msgs[myid] \u003d future"},{"line_number":196,"context_line":"            try:"},{"line_number":197,"context_line":"                self.writer.send((myid, msg))"}],"source_content_type":"text/x-python","patch_set":3,"id":"7eb96e6f_ee34633c","line":194,"range":{"start_line":194,"start_character":16,"end_line":194,"end_character":77},"updated":"2021-06-10 17:37:45.000000000","message":"because myid is generated everytime we call send_recv, instead of this, we should check that in L190. If the UUID is duplicated (that will never never happen), we should generate a new one.\n\nThis check (L193-194) is not needed.","commit_id":"f20a5b820fa424f5338ca970c0c0fb3e18cea9cf"},{"author":{"_account_id":8313,"name":"Lajos Katona","display_name":"lajoskatona","email":"katonalala@gmail.com","username":"elajkat","status":"Ericsson Software Technology"},"change_message_id":"ad2040112e9e9ca1a22142c3b5e1a41573d5fa79","unresolved":true,"context_lines":[{"line_number":191,"context_line":""},{"line_number":192,"context_line":"        with self.lock:"},{"line_number":193,"context_line":"            if myid in self.outstanding_msgs:"},{"line_number":194,"context_line":"                raise AssertionError(\"myid shoudn\u0027t be in outstanding_msgs.\")"},{"line_number":195,"context_line":"            self.outstanding_msgs[myid] \u003d future"},{"line_number":196,"context_line":"            try:"},{"line_number":197,"context_line":"                self.writer.send((myid, msg))"}],"source_content_type":"text/x-python","patch_set":3,"id":"e925cc45_73d23f67","line":194,"range":{"start_line":194,"start_character":16,"end_line":194,"end_character":77},"in_reply_to":"7eb96e6f_ee34633c","updated":"2021-06-11 10:18:24.000000000","message":"thanks.\nI changed the assert part @l154 to be a warning as with timeout the myid can be deleted from the outstanding_msgs dict.\nHmmm, I check if the finnaly part can be changed to be conditional like:\nfinally:\n    if Message.ERR not in reply.data:\n        del self.outstanding_msgs[myid]","commit_id":"f20a5b820fa424f5338ca970c0c0fb3e18cea9cf"}],"oslo_privsep/daemon.py":[{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"6bed96f05363828575933e20d6903f3291adfea7","unresolved":true,"context_lines":[{"line_number":369,"context_line":""},{"line_number":370,"context_line":"            sock, _addr \u003d listen_sock.accept()"},{"line_number":371,"context_line":"            LOG.debug(\u0027Accepted privsep connection to %s\u0027, sockpath)"},{"line_number":372,"context_line":""},{"line_number":373,"context_line":"        finally:"},{"line_number":374,"context_line":"            # Don\u0027t need listen_sock anymore, so clean up."},{"line_number":375,"context_line":"            listen_sock.close()"}],"source_content_type":"text/x-python","patch_set":3,"id":"cc579558_3f308ba6","side":"PARENT","line":372,"updated":"2021-06-10 17:31:35.000000000","message":"unrelated","commit_id":"165cdde8a33924cd27a567ea01889dfda3353cf6"}],"oslo_privsep/priv_context.py":[{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"79878f05877cd48316b96074339ab91ee6acee87","unresolved":true,"context_lines":[{"line_number":150,"context_line":"        cfg.CONF.register_opts(OPTS, group\u003dcfg_section)"},{"line_number":151,"context_line":"        cfg.CONF.set_default(\u0027capabilities\u0027, group\u003dcfg_section,"},{"line_number":152,"context_line":"                             default\u003dcapabilities)"},{"line_number":153,"context_line":"        self.timeout \u003d None"},{"line_number":154,"context_line":""},{"line_number":155,"context_line":"    @property"},{"line_number":156,"context_line":"    def conf(self):"}],"source_content_type":"text/x-python","patch_set":1,"id":"cf4a347c_8ad84716","line":153,"range":{"start_line":153,"start_character":8,"end_line":153,"end_character":27},"updated":"2021-06-07 09:30:51.000000000","message":"If you want to assign a default value, provide an argument to the init method, with None as default value.","commit_id":"816d56ab3d340c5084fd1fe5af9fec71f89ae097"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"0b932f10f456960b49d17e4105ca4f9417208a24","unresolved":true,"context_lines":[{"line_number":217,"context_line":"    def entrypoint(self, func\u003dNone, *args, **kwargs):"},{"line_number":218,"context_line":"        \"\"\"This is intended to be used as a decorator.\"\"\""},{"line_number":219,"context_line":""},{"line_number":220,"context_line":"        timeout \u003d kwargs.get(\u0027timeout\u0027)"},{"line_number":221,"context_line":"        if not func:"},{"line_number":222,"context_line":"            return functools.partial(self.entrypoint, timeout\u003dtimeout)"},{"line_number":223,"context_line":"        if not func.__module__.startswith(self.prefix):"},{"line_number":224,"context_line":"            raise AssertionError(\u0027%r entrypoints must be below \"%s\"\u0027 %"},{"line_number":225,"context_line":"                                 (self, self.prefix))"}],"source_content_type":"text/x-python","patch_set":1,"id":"1f47fe75_b0e5cdd8","line":222,"range":{"start_line":220,"start_character":8,"end_line":222,"end_character":70},"updated":"2021-06-07 07:36:42.000000000","message":"not sure I understand the logic here, why not set timeout on __init__()?","commit_id":"816d56ab3d340c5084fd1fe5af9fec71f89ae097"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"bddbfd2003fe53e08d27009e591ee7258c6e3a5f","unresolved":true,"context_lines":[{"line_number":217,"context_line":"    def entrypoint(self, func\u003dNone, *args, **kwargs):"},{"line_number":218,"context_line":"        \"\"\"This is intended to be used as a decorator.\"\"\""},{"line_number":219,"context_line":""},{"line_number":220,"context_line":"        timeout \u003d kwargs.get(\u0027timeout\u0027)"},{"line_number":221,"context_line":"        if not func:"},{"line_number":222,"context_line":"            return functools.partial(self.entrypoint, timeout\u003dtimeout)"},{"line_number":223,"context_line":"        if not func.__module__.startswith(self.prefix):"},{"line_number":224,"context_line":"            raise AssertionError(\u0027%r entrypoints must be below \"%s\"\u0027 %"},{"line_number":225,"context_line":"                                 (self, self.prefix))"}],"source_content_type":"text/x-python","patch_set":1,"id":"fcbf0cf9_5ef3f5f7","line":222,"range":{"start_line":220,"start_character":8,"end_line":222,"end_character":70},"in_reply_to":"1f47fe75_b0e5cdd8","updated":"2021-06-07 09:31:24.000000000","message":"Yeah, this is the same as I tried before [1]. The decorator will provide, if needed, the timeout for this specific method. If during the context creation no timeout is defined, the specific decorator timeout will be used. Of course, we can always assign a default timeout value.\n\n@Lajos, this is not going to work: the \"entrypoint\" decorator implementation does not admit parameters. You need to do something similar to [1]. You need an implementation for a decorator without parameters and another allowing parameters (entrypoint_with_timeout). Or you can just create something like:\n\n    def entrypoint(self, timeout\u003dNone):\n        def wrap(func):\n            @functools.wraps(func)\n            def inner(*args, **kwargs):\n                f \u003d self._entrypoint(func)\n                # \"_wrap_timeout_value\" name to avoid shadowing \"timeout\" in kwargs\n                # if the wrapped method is using it (there are plenty of them).\n                timeout \u003d timeout or self.timeout\n                return f(*args, _wrap_timeout_value\u003dtimeout, **kwargs)\n            setattr(inner, _ENTRYPOINT_ATTR, self)\n            return inner\n        return wrap\n\n    def _wrap(self, func, *args, _wrap_timeout_value\u003dNone, **kwargs):\n        if self.client_mode:\n            name \u003d \u0027%s.%s\u0027 % (func.__module__, func.__name__)\n            if self.channel is not None and not self.channel.running:\n                LOG.warning(\"RESTARTING PrivContext for %s\", name)\n                self.stop()\n            if self.channel is None:\n                self.start()\n            return self.channel.remote_call(name, args, kwargs, _wrap_timeout_value)\n        else:\n            return func(*args, **kwargs)\n\n\n[1]https://review.opendev.org/c/openstack/oslo.privsep/+/782981/3/oslo_privsep/priv_context.py","commit_id":"816d56ab3d340c5084fd1fe5af9fec71f89ae097"},{"author":{"_account_id":8313,"name":"Lajos Katona","display_name":"lajoskatona","email":"katonalala@gmail.com","username":"elajkat","status":"Ericsson Software Technology"},"change_message_id":"d23f5e0164b8db30f4ad7e19ea9703ff7d583544","unresolved":true,"context_lines":[{"line_number":217,"context_line":"    def entrypoint(self, func\u003dNone, *args, **kwargs):"},{"line_number":218,"context_line":"        \"\"\"This is intended to be used as a decorator.\"\"\""},{"line_number":219,"context_line":""},{"line_number":220,"context_line":"        timeout \u003d kwargs.get(\u0027timeout\u0027)"},{"line_number":221,"context_line":"        if not func:"},{"line_number":222,"context_line":"            return functools.partial(self.entrypoint, timeout\u003dtimeout)"},{"line_number":223,"context_line":"        if not func.__module__.startswith(self.prefix):"},{"line_number":224,"context_line":"            raise AssertionError(\u0027%r entrypoints must be below \"%s\"\u0027 %"},{"line_number":225,"context_line":"                                 (self, self.prefix))"}],"source_content_type":"text/x-python","patch_set":1,"id":"9daef4bf_d8517181","line":222,"range":{"start_line":220,"start_character":8,"end_line":222,"end_character":70},"in_reply_to":"fcbf0cf9_5ef3f5f7","updated":"2021-06-07 15:28:46.000000000","message":"Thanks I check it, actually I thought of having 2 decorator with and without timeout, perhaps that\u0027s the most straightforward way for it.\nI check it.\n\nOleg: in that case the granularity will be worse, like we create foo.PrivContext(....., timeout\u003dx) and all commands which use that privcontext  (foo.entrypoint ) will have that timeout, if we have a decorator with param we can have (or do not have) different timeout for all our commands decorated with that priv context.","commit_id":"816d56ab3d340c5084fd1fe5af9fec71f89ae097"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"6bed96f05363828575933e20d6903f3291adfea7","unresolved":true,"context_lines":[{"line_number":232,"context_line":"        return wrap"},{"line_number":233,"context_line":""},{"line_number":234,"context_line":"    def _entrypoint(self, func):"},{"line_number":235,"context_line":"        \"\"\"This is intended to be used as a decorator.\"\"\""},{"line_number":236,"context_line":""},{"line_number":237,"context_line":"        if not func.__module__.startswith(self.prefix):"},{"line_number":238,"context_line":"            raise AssertionError(\u0027%r entrypoints must be below \"%s\"\u0027 %"}],"source_content_type":"text/x-python","patch_set":3,"id":"97c10594_5d9b38b5","line":235,"range":{"start_line":235,"start_character":11,"end_line":235,"end_character":53},"updated":"2021-06-10 17:31:35.000000000","message":"hmmm, not anymore","commit_id":"f20a5b820fa424f5338ca970c0c0fb3e18cea9cf"},{"author":{"_account_id":8313,"name":"Lajos Katona","display_name":"lajoskatona","email":"katonalala@gmail.com","username":"elajkat","status":"Ericsson Software Technology"},"change_message_id":"ad2040112e9e9ca1a22142c3b5e1a41573d5fa79","unresolved":false,"context_lines":[{"line_number":232,"context_line":"        return wrap"},{"line_number":233,"context_line":""},{"line_number":234,"context_line":"    def _entrypoint(self, func):"},{"line_number":235,"context_line":"        \"\"\"This is intended to be used as a decorator.\"\"\""},{"line_number":236,"context_line":""},{"line_number":237,"context_line":"        if not func.__module__.startswith(self.prefix):"},{"line_number":238,"context_line":"            raise AssertionError(\u0027%r entrypoints must be below \"%s\"\u0027 %"}],"source_content_type":"text/x-python","patch_set":3,"id":"565db4f5_f85ad833","line":235,"range":{"start_line":235,"start_character":11,"end_line":235,"end_character":53},"in_reply_to":"97c10594_5d9b38b5","updated":"2021-06-11 10:18:24.000000000","message":"Done","commit_id":"f20a5b820fa424f5338ca970c0c0fb3e18cea9cf"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"6bed96f05363828575933e20d6903f3291adfea7","unresolved":true,"context_lines":[{"line_number":262,"context_line":"                self.stop()"},{"line_number":263,"context_line":"            if self.channel is None:"},{"line_number":264,"context_line":"                self.start()"},{"line_number":265,"context_line":"            r_call_timeout \u003d None"},{"line_number":266,"context_line":"            if _wrap_timeout:"},{"line_number":267,"context_line":"                r_call_timeout \u003d _wrap_timeout"},{"line_number":268,"context_line":"            elif self.timeout and not _wrap_timeout:"},{"line_number":269,"context_line":"                r_call_timeout \u003d self.timeout"},{"line_number":270,"context_line":"            return self.channel.remote_call(name, args, kwargs,"},{"line_number":271,"context_line":"                                            r_call_timeout)"},{"line_number":272,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":3,"id":"454841fe_0903abe6","line":269,"range":{"start_line":265,"start_character":12,"end_line":269,"end_character":45},"updated":"2021-06-10 17:31:35.000000000","message":"_wrap_timeout \u003d _wrap_timeout or self.timeout","commit_id":"f20a5b820fa424f5338ca970c0c0fb3e18cea9cf"},{"author":{"_account_id":8313,"name":"Lajos Katona","display_name":"lajoskatona","email":"katonalala@gmail.com","username":"elajkat","status":"Ericsson Software Technology"},"change_message_id":"ad2040112e9e9ca1a22142c3b5e1a41573d5fa79","unresolved":false,"context_lines":[{"line_number":262,"context_line":"                self.stop()"},{"line_number":263,"context_line":"            if self.channel is None:"},{"line_number":264,"context_line":"                self.start()"},{"line_number":265,"context_line":"            r_call_timeout \u003d None"},{"line_number":266,"context_line":"            if _wrap_timeout:"},{"line_number":267,"context_line":"                r_call_timeout \u003d _wrap_timeout"},{"line_number":268,"context_line":"            elif self.timeout and not _wrap_timeout:"},{"line_number":269,"context_line":"                r_call_timeout \u003d self.timeout"},{"line_number":270,"context_line":"            return self.channel.remote_call(name, args, kwargs,"},{"line_number":271,"context_line":"                                            r_call_timeout)"},{"line_number":272,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":3,"id":"ae4f1131_225ce7f9","line":269,"range":{"start_line":265,"start_character":12,"end_line":269,"end_character":45},"in_reply_to":"454841fe_0903abe6","updated":"2021-06-11 10:18:24.000000000","message":"Done","commit_id":"f20a5b820fa424f5338ca970c0c0fb3e18cea9cf"}],"oslo_privsep/tests/test_priv_context.py":[{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"6bed96f05363828575933e20d6903f3291adfea7","unresolved":true,"context_lines":[{"line_number":45,"context_line":"@testctx.context.entrypoint_with_timeout(0.2)"},{"line_number":46,"context_line":"def do_some_long(long_timeout\u003d0.4):"},{"line_number":47,"context_line":"    time.sleep(long_timeout)"},{"line_number":48,"context_line":"    return 42"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"class CustomError(Exception):"}],"source_content_type":"text/x-python","patch_set":3,"id":"99e36960_126f77aa","line":48,"range":{"start_line":48,"start_character":11,"end_line":48,"end_character":13},"updated":"2021-06-10 17:31:35.000000000","message":"https://hitchhikers.fandom.com/wiki/42  +1","commit_id":"f20a5b820fa424f5338ca970c0c0fb3e18cea9cf"}]}
