)]}'
{"oslo_log/formatters.py":[{"author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"tag":"autogenerated:zuul:check","change_message_id":"0d0098dbd71f1e89c0e61b87671686168a723256","unresolved":false,"context_lines":[{"line_number":291,"context_line":"            self.hostname \u003d None"},{"line_number":292,"context_line":"        self.cmdline \u003d \" \".join(sys.argv)"},{"line_number":293,"context_line":"        try:"},{"line_number":294,"context_line":"            ## check if running under uwsgi"},{"line_number":295,"context_line":"            import uwsgi"},{"line_number":296,"context_line":"            svc_name \u003d uwsgi.opt.get(\"name\")"},{"line_number":297,"context_line":"            self.uwsgi_name \u003d svc_name"}],"source_content_type":"text/x-python","patch_set":1,"id":"bf51134e_3062513f","line":294,"updated":"2020-07-11 15:58:10.000000000","message":"pep8: E266 too many leading \u0027#\u0027 for block comment","commit_id":"7e21ebe4a810adf14a9f5ce63ce5a7fdf611bab3"},{"author":{"_account_id":22348,"name":"Zuul","username":"zuul","tags":["SERVICE_USER"]},"tag":"autogenerated:zuul:check","change_message_id":"0d0098dbd71f1e89c0e61b87671686168a723256","unresolved":false,"context_lines":[{"line_number":295,"context_line":"            import uwsgi"},{"line_number":296,"context_line":"            svc_name \u003d uwsgi.opt.get(\"name\")"},{"line_number":297,"context_line":"            self.uwsgi_name \u003d svc_name"},{"line_number":298,"context_line":"        except Exception as e:"},{"line_number":299,"context_line":"            self.uwsgi_name \u003d None"},{"line_number":300,"context_line":""},{"line_number":301,"context_line":"    def formatException(self, exc_info, strip_newlines\u003dTrue):"}],"source_content_type":"text/x-python","patch_set":1,"id":"bf51134e_10674d4f","line":298,"updated":"2020-07-11 15:58:10.000000000","message":"pep8: F841 local variable \u0027e\u0027 is assigned to but never used","commit_id":"7e21ebe4a810adf14a9f5ce63ce5a7fdf611bab3"},{"author":{"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},"change_message_id":"2d588b452492fcaa45c862d1aa598413f537769e","unresolved":false,"context_lines":[{"line_number":292,"context_line":"        self.cmdline \u003d \" \".join(sys.argv)"},{"line_number":293,"context_line":"        try:"},{"line_number":294,"context_line":"            # check if running under uwsgi"},{"line_number":295,"context_line":"            import uwsgi"},{"line_number":296,"context_line":"            svc_name \u003d uwsgi.opt.get(\"name\")"},{"line_number":297,"context_line":"            self.uwsgi_name \u003d svc_name"},{"line_number":298,"context_line":"        except Exception:"}],"source_content_type":"text/x-python","patch_set":2,"id":"bf51134e_58054045","line":295,"range":{"start_line":295,"start_character":12,"end_line":295,"end_character":24},"updated":"2020-07-15 10:04:11.000000000","message":"I wondering if this import shouldn\u0027t be with other imports at the beginning of this file.\n\nEven if CI|pep8|hacking seems happy with that I think it break the H306 rule [1].\n\nIIRC I don\u0027t seen imports in the middle of the code in oslo\u0027s projects.\n\nSo, please move this import with the others.\n\n[1] https://docs.openstack.org/hacking/latest/user/hacking.html#imports","commit_id":"6f9b434bb3bc4014d5041f6b1a1da858e3d4aa77"},{"author":{"_account_id":26768,"name":"Jan Vondra","email":"jan.vondra@ultimum.io","username":"JanVondra"},"change_message_id":"80a6c2c319170c261e8789d9a2e0221aeecef11f","unresolved":false,"context_lines":[{"line_number":292,"context_line":"        self.cmdline \u003d \" \".join(sys.argv)"},{"line_number":293,"context_line":"        try:"},{"line_number":294,"context_line":"            # check if running under uwsgi"},{"line_number":295,"context_line":"            import uwsgi"},{"line_number":296,"context_line":"            svc_name \u003d uwsgi.opt.get(\"name\")"},{"line_number":297,"context_line":"            self.uwsgi_name \u003d svc_name"},{"line_number":298,"context_line":"        except Exception:"}],"source_content_type":"text/x-python","patch_set":2,"id":"bf51134e_d864b024","line":295,"range":{"start_line":295,"start_character":12,"end_line":295,"end_character":24},"in_reply_to":"bf51134e_58054045","updated":"2020-07-15 10:15:24.000000000","message":"The point is that importing uwsgi fails when running as standalone daemon - i.e. this is actually the check if the code is executed via uwsgi.","commit_id":"6f9b434bb3bc4014d5041f6b1a1da858e3d4aa77"},{"author":{"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},"change_message_id":"2f4e47fac84977cc6579e6a52d53616fc5b302a4","unresolved":false,"context_lines":[{"line_number":292,"context_line":"        self.cmdline \u003d \" \".join(sys.argv)"},{"line_number":293,"context_line":"        try:"},{"line_number":294,"context_line":"            # check if running under uwsgi"},{"line_number":295,"context_line":"            import uwsgi"},{"line_number":296,"context_line":"            svc_name \u003d uwsgi.opt.get(\"name\")"},{"line_number":297,"context_line":"            self.uwsgi_name \u003d svc_name"},{"line_number":298,"context_line":"        except Exception:"}],"source_content_type":"text/x-python","patch_set":2,"id":"bf51134e_d377719f","line":295,"range":{"start_line":295,"start_character":12,"end_line":295,"end_character":24},"in_reply_to":"bf51134e_d864b024","updated":"2020-07-15 10:26:55.000000000","message":"got it.","commit_id":"6f9b434bb3bc4014d5041f6b1a1da858e3d4aa77"},{"author":{"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},"change_message_id":"2d588b452492fcaa45c862d1aa598413f537769e","unresolved":false,"context_lines":[{"line_number":290,"context_line":"        except socket.error:"},{"line_number":291,"context_line":"            self.hostname \u003d None"},{"line_number":292,"context_line":"        self.cmdline \u003d \" \".join(sys.argv)"},{"line_number":293,"context_line":"        try:"},{"line_number":294,"context_line":"            # check if running under uwsgi"},{"line_number":295,"context_line":"            import uwsgi"},{"line_number":296,"context_line":"            svc_name \u003d uwsgi.opt.get(\"name\")"},{"line_number":297,"context_line":"            self.uwsgi_name \u003d svc_name"},{"line_number":298,"context_line":"        except Exception:"},{"line_number":299,"context_line":"            self.uwsgi_name \u003d None"},{"line_number":300,"context_line":""},{"line_number":301,"context_line":"    def formatException(self, exc_info, strip_newlines\u003dTrue):"},{"line_number":302,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":2,"id":"bf51134e_38004c34","line":299,"range":{"start_line":293,"start_character":8,"end_line":299,"end_character":34},"updated":"2020-07-15 10:04:11.000000000","message":"`opt` isn\u0027t a dict?\n\nIf yes it could be rewritten like this:\n\n```\nself.uwsgi_name \u003d uwsgi.opt.get(\"name\")\n```\n\nIt will avoid the try/except section, Indeed, Python dictionary method get() returns a value for the given key. If key is not available then returns default value None. So you don\u0027t have to except something.\n\nI suppose you looking for a `KeyError` exception, I think that except for `Exception` is a bit too much, and KeyError could be more appropriate here.\n\nElse which exception are you expect to happen here?","commit_id":"6f9b434bb3bc4014d5041f6b1a1da858e3d4aa77"},{"author":{"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},"change_message_id":"23dfb0fbd789608a0e74d804a1251c17d506f221","unresolved":false,"context_lines":[{"line_number":290,"context_line":"        except socket.error:"},{"line_number":291,"context_line":"            self.hostname \u003d None"},{"line_number":292,"context_line":"        self.cmdline \u003d \" \".join(sys.argv)"},{"line_number":293,"context_line":"        try:"},{"line_number":294,"context_line":"            # check if running under uwsgi"},{"line_number":295,"context_line":"            import uwsgi"},{"line_number":296,"context_line":"            svc_name \u003d uwsgi.opt.get(\"name\")"},{"line_number":297,"context_line":"            self.uwsgi_name \u003d svc_name"},{"line_number":298,"context_line":"        except Exception:"},{"line_number":299,"context_line":"            self.uwsgi_name \u003d None"},{"line_number":300,"context_line":""},{"line_number":301,"context_line":"    def formatException(self, exc_info, strip_newlines\u003dTrue):"},{"line_number":302,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":2,"id":"bf51134e_ceb98acc","line":299,"range":{"start_line":293,"start_character":8,"end_line":299,"end_character":34},"in_reply_to":"bf51134e_13fe096a","updated":"2020-07-15 11:39:30.000000000","message":"\u003e Well, in my opinion it\u0027s more intuitive to setting the\n \u003e self.uwsgi_name to None in except block since it clearly says that\n \u003e if any error occurs when getting the value it\u0027s set to None. When\n \u003e not running under uwsgi this variable is meaningless so from\n \u003e semantic point of view stating default value before would be\n \u003e confusing.\n\nOk, then lets init the default here.\n\n \u003e \n \u003e Putting log.debug (or better log.exception) would be definitely\n \u003e nice - however - it\u0027s oslo.log and this code is executed before\n \u003e (more precisely during) initialization of logging module thus its\n \u003e not possible. That\u0027s the main point of not wanting to invoke any\n \u003e error here.\n\nOk I seen.","commit_id":"6f9b434bb3bc4014d5041f6b1a1da858e3d4aa77"},{"author":{"_account_id":26768,"name":"Jan Vondra","email":"jan.vondra@ultimum.io","username":"JanVondra"},"change_message_id":"80a6c2c319170c261e8789d9a2e0221aeecef11f","unresolved":false,"context_lines":[{"line_number":290,"context_line":"        except socket.error:"},{"line_number":291,"context_line":"            self.hostname \u003d None"},{"line_number":292,"context_line":"        self.cmdline \u003d \" \".join(sys.argv)"},{"line_number":293,"context_line":"        try:"},{"line_number":294,"context_line":"            # check if running under uwsgi"},{"line_number":295,"context_line":"            import uwsgi"},{"line_number":296,"context_line":"            svc_name \u003d uwsgi.opt.get(\"name\")"},{"line_number":297,"context_line":"            self.uwsgi_name \u003d svc_name"},{"line_number":298,"context_line":"        except Exception:"},{"line_number":299,"context_line":"            self.uwsgi_name \u003d None"},{"line_number":300,"context_line":""},{"line_number":301,"context_line":"    def formatException(self, exc_info, strip_newlines\u003dTrue):"},{"line_number":302,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":2,"id":"bf51134e_782764c8","line":299,"range":{"start_line":293,"start_character":8,"end_line":299,"end_character":34},"in_reply_to":"bf51134e_38004c34","updated":"2020-07-15 10:15:24.000000000","message":"No, I am not looking for KeyError - the most probable error to catch is ImportError. From my point of view it\u0027s much better to use broad exception clause here because it\u0027s pretty much ok to not have the uwsgi_name key in log events rather than having failed daemon due to any error (e.g. change in uwsgi options file) and since it\u0027s oslo.log user will not be informed because log system is not initialized at this point.","commit_id":"6f9b434bb3bc4014d5041f6b1a1da858e3d4aa77"},{"author":{"_account_id":26768,"name":"Jan Vondra","email":"jan.vondra@ultimum.io","username":"JanVondra"},"change_message_id":"fc54be481a66e6cc839c2b3cda88c4b31cfcc2b3","unresolved":false,"context_lines":[{"line_number":290,"context_line":"        except socket.error:"},{"line_number":291,"context_line":"            self.hostname \u003d None"},{"line_number":292,"context_line":"        self.cmdline \u003d \" \".join(sys.argv)"},{"line_number":293,"context_line":"        try:"},{"line_number":294,"context_line":"            # check if running under uwsgi"},{"line_number":295,"context_line":"            import uwsgi"},{"line_number":296,"context_line":"            svc_name \u003d uwsgi.opt.get(\"name\")"},{"line_number":297,"context_line":"            self.uwsgi_name \u003d svc_name"},{"line_number":298,"context_line":"        except Exception:"},{"line_number":299,"context_line":"            self.uwsgi_name \u003d None"},{"line_number":300,"context_line":""},{"line_number":301,"context_line":"    def formatException(self, exc_info, strip_newlines\u003dTrue):"},{"line_number":302,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":2,"id":"bf51134e_13fe096a","line":299,"range":{"start_line":293,"start_character":8,"end_line":299,"end_character":34},"in_reply_to":"bf51134e_73b82510","updated":"2020-07-15 10:46:31.000000000","message":"Well, in my opinion it\u0027s more intuitive to setting the self.uwsgi_name to None in except block since it clearly says that if any error occurs when getting the value it\u0027s set to None. When not running under uwsgi this variable is meaningless so from semantic point of view stating default value before would be confusing.\n\nPutting log.debug (or better log.exception) would be definitely nice - however - it\u0027s oslo.log and this code is executed before (more precisely during) initialization of logging module thus its not possible. That\u0027s the main point of not wanting to invoke any error here.","commit_id":"6f9b434bb3bc4014d5041f6b1a1da858e3d4aa77"},{"author":{"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},"change_message_id":"2f4e47fac84977cc6579e6a52d53616fc5b302a4","unresolved":false,"context_lines":[{"line_number":290,"context_line":"        except socket.error:"},{"line_number":291,"context_line":"            self.hostname \u003d None"},{"line_number":292,"context_line":"        self.cmdline \u003d \" \".join(sys.argv)"},{"line_number":293,"context_line":"        try:"},{"line_number":294,"context_line":"            # check if running under uwsgi"},{"line_number":295,"context_line":"            import uwsgi"},{"line_number":296,"context_line":"            svc_name \u003d uwsgi.opt.get(\"name\")"},{"line_number":297,"context_line":"            self.uwsgi_name \u003d svc_name"},{"line_number":298,"context_line":"        except Exception:"},{"line_number":299,"context_line":"            self.uwsgi_name \u003d None"},{"line_number":300,"context_line":""},{"line_number":301,"context_line":"    def formatException(self, exc_info, strip_newlines\u003dTrue):"},{"line_number":302,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":2,"id":"bf51134e_73b82510","line":299,"range":{"start_line":293,"start_character":8,"end_line":299,"end_character":34},"in_reply_to":"bf51134e_782764c8","updated":"2020-07-15 10:26:55.000000000","message":"Thanks for the given details, then I think it could be worth to add a comment to highlight this point.\n\nAlso what do you think about init `self.uwsgi_name \u003d None` by default before the `try/except` to be sure to retrieve it all the time and add a log.debug under the `except` statement with the catched error to help us during debug session, it could help us to identify the kind of error we faced.","commit_id":"6f9b434bb3bc4014d5041f6b1a1da858e3d4aa77"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"25b4c74fee4df36b85618682d7bc648d6acd7fb7","unresolved":false,"context_lines":[{"line_number":359,"context_line":"            message[\u0027traceback\u0027] \u003d self.formatException(record.exc_info)"},{"line_number":360,"context_line":""},{"line_number":361,"context_line":"        if self.uwsgi_name:"},{"line_number":362,"context_line":"            message[\"uwsgi_name\"] \u003d self.uwsgi_name"},{"line_number":363,"context_line":""},{"line_number":364,"context_line":"        return message"},{"line_number":365,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"9f560f44_5b6f0ec4","line":362,"range":{"start_line":362,"start_character":20,"end_line":362,"end_character":21},"updated":"2020-08-06 15:01:22.000000000","message":"nit \u0027\u0027","commit_id":"6f9b434bb3bc4014d5041f6b1a1da858e3d4aa77"}]}
