)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"7ad2ba7f03e0e26e92fcca4079449cadca76d31a","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Log iptables rules when they fail to apply"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Log the set of rules that causes iptables-restore"},{"line_number":10,"context_line":"to fail on the security group agent."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Closes-Bug: #1306399"},{"line_number":13,"context_line":"Change-Id: I8e94c1faae75760e439c5abe3d9b723548398105"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"AAAAW3%2F%2Flko%3D","line":10,"updated":"2014-04-11 23:28:53.000000000","message":"it also logs on the FWaaS ?","commit_id":"6b273210e38a61e526f1dba9ea840adb011ba21d"}],"neutron/agent/linux/iptables_manager.py":[{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"1d10e958b34604e41918ba7ef5c85e1444def81a","unresolved":false,"context_lines":[{"line_number":403,"context_line":"            except RuntimeError:"},{"line_number":404,"context_line":"                with excutils.save_and_reraise_exception():"},{"line_number":405,"context_line":"                    LOG.error(_(\"IPTablesManager.apply failed to apply the \""},{"line_number":406,"context_line":"                                \"following set of iptables rules: %s\"),"},{"line_number":407,"context_line":"                              \u0027\\n\u0027.join(all_lines))"},{"line_number":408,"context_line":"        LOG.debug(_(\"IPTablesManager.apply completed with success\"))"},{"line_number":409,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAW3%2F%2FqYE%3D","line":406,"updated":"2014-04-11 10:35:03.000000000","message":"nit: if \"%s\" would be on the new line then all iptables rules will be printed with the same indentation. This print will have the first rule on the line with message and can be easily missed when reading logs.","commit_id":"672370e69462fefddada99fd9c7d181841b12877"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"6aced22cb4ed6b94e0a78dd5022001009c617774","unresolved":false,"context_lines":[{"line_number":403,"context_line":"            except RuntimeError:"},{"line_number":404,"context_line":"                with excutils.save_and_reraise_exception():"},{"line_number":405,"context_line":"                    LOG.error(_(\"IPTablesManager.apply failed to apply the \""},{"line_number":406,"context_line":"                                \"following set of iptables rules: %s\"),"},{"line_number":407,"context_line":"                              \u0027\\n\u0027.join(all_lines))"},{"line_number":408,"context_line":"        LOG.debug(_(\"IPTablesManager.apply completed with success\"))"},{"line_number":409,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAW3%2F%2FnWE%3D","line":406,"in_reply_to":"AAAAW3%2F%2FqYE%3D","updated":"2014-04-11 18:14:29.000000000","message":"good call","commit_id":"672370e69462fefddada99fd9c7d181841b12877"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"76c85151da9553fbbd6f2f12fc4d84797143751b","unresolved":false,"context_lines":[{"line_number":401,"context_line":"                self.execute(args, process_input\u003d\u0027\\n\u0027.join(all_lines),"},{"line_number":402,"context_line":"                             root_helper\u003dself.root_helper)"},{"line_number":403,"context_line":"            except RuntimeError:"},{"line_number":404,"context_line":"                with excutils.save_and_reraise_exception():"},{"line_number":405,"context_line":"                    LOG.error(_(\"IPTablesManager.apply failed to apply the \""},{"line_number":406,"context_line":"                                \"following set of iptables rules:\\n%s\"),"},{"line_number":407,"context_line":"                              \u0027\\n\u0027.join(all_lines))"}],"source_content_type":"text/x-python","patch_set":9,"id":"9ad9bd40_52ec4cf3","line":404,"updated":"2014-05-07 10:30:56.000000000","message":"why do you think the exception context could be cleared here?","commit_id":"52169bd4d525694ae4eb4095d2b161dfae1963a4"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"6b213ac6b0d0eb48e00123d1d2d4793304647595","unresolved":false,"context_lines":[{"line_number":401,"context_line":"                self.execute(args, process_input\u003d\u0027\\n\u0027.join(all_lines),"},{"line_number":402,"context_line":"                             root_helper\u003dself.root_helper)"},{"line_number":403,"context_line":"            except RuntimeError:"},{"line_number":404,"context_line":"                with excutils.save_and_reraise_exception():"},{"line_number":405,"context_line":"                    LOG.error(_(\"IPTablesManager.apply failed to apply the \""},{"line_number":406,"context_line":"                                \"following set of iptables rules:\\n%s\"),"},{"line_number":407,"context_line":"                              \u0027\\n\u0027.join(all_lines))"}],"source_content_type":"text/x-python","patch_set":9,"id":"7adec928_399cb869","line":404,"in_reply_to":"9ad9bd40_52ec4cf3","updated":"2014-05-07 20:52:12.000000000","message":"I was foreseeing the exception-prone complexity you would request me to add in your review. :-)\n\nIt\u0027s just a habit at this point. If I don\u0027t do it, someone will usually complain about it.","commit_id":"52169bd4d525694ae4eb4095d2b161dfae1963a4"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"76c85151da9553fbbd6f2f12fc4d84797143751b","unresolved":false,"context_lines":[{"line_number":404,"context_line":"                with excutils.save_and_reraise_exception():"},{"line_number":405,"context_line":"                    LOG.error(_(\"IPTablesManager.apply failed to apply the \""},{"line_number":406,"context_line":"                                \"following set of iptables rules:\\n%s\"),"},{"line_number":407,"context_line":"                              \u0027\\n\u0027.join(all_lines))"},{"line_number":408,"context_line":"        LOG.debug(_(\"IPTablesManager.apply completed with success\"))"},{"line_number":409,"context_line":""},{"line_number":410,"context_line":"    def _find_table(self, lines, table_name):"}],"source_content_type":"text/x-python","patch_set":9,"id":"9ad9bd40_72a310b2","line":407,"updated":"2014-05-07 10:30:56.000000000","message":"In some circumstances this can drop thousand of lines on the log file, which perhaps won\u0027t be great. Also, people looking at logs will still need to find the stderr output from self.execute, retrieve the offending line, and find it in the text dumped in the log.\n\nI suggest two options:\n1) Parse output, and if a line number is found, print only that line\n2) Print also line numbers in the statement above\n\nI prefer the first, but I understand it might be a bit more convoluted.","commit_id":"52169bd4d525694ae4eb4095d2b161dfae1963a4"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"6b213ac6b0d0eb48e00123d1d2d4793304647595","unresolved":false,"context_lines":[{"line_number":404,"context_line":"                with excutils.save_and_reraise_exception():"},{"line_number":405,"context_line":"                    LOG.error(_(\"IPTablesManager.apply failed to apply the \""},{"line_number":406,"context_line":"                                \"following set of iptables rules:\\n%s\"),"},{"line_number":407,"context_line":"                              \u0027\\n\u0027.join(all_lines))"},{"line_number":408,"context_line":"        LOG.debug(_(\"IPTablesManager.apply completed with success\"))"},{"line_number":409,"context_line":""},{"line_number":410,"context_line":"    def _find_table(self, lines, table_name):"}],"source_content_type":"text/x-python","patch_set":9,"id":"7adec928_744f2593","line":407,"in_reply_to":"9ad9bd40_72a310b2","updated":"2014-05-07 20:52:12.000000000","message":"why not both?","commit_id":"52169bd4d525694ae4eb4095d2b161dfae1963a4"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"9e11e4067819aab8d791e62c375773db2ea0ecfb","unresolved":false,"context_lines":[{"line_number":404,"context_line":"            except RuntimeError as r_error:"},{"line_number":405,"context_line":"                with excutils.save_and_reraise_exception():"},{"line_number":406,"context_line":"                    try:"},{"line_number":407,"context_line":"                        lnum \u003d int(re.search("},{"line_number":408,"context_line":"                            \u0027iptables-restore: line ([0-9]+?) failed\u0027,"},{"line_number":409,"context_line":"                            str(r_error)).group(1))"},{"line_number":410,"context_line":"                        # get a few surrounding lines for context and put line"}],"source_content_type":"text/x-python","patch_set":10,"id":"7adec928_0cd07c4f","line":407,"updated":"2014-05-08 18:10:27.000000000","message":"nit: linenum, lineno, or something would ease reading through the code a bit more for me than lnum.","commit_id":"6340997b50af479123125f92b883d8fef564401d"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"db548d99f8eea05f722d32141aac18344e000855","unresolved":false,"context_lines":[{"line_number":404,"context_line":"            except RuntimeError as r_error:"},{"line_number":405,"context_line":"                with excutils.save_and_reraise_exception():"},{"line_number":406,"context_line":"                    try:"},{"line_number":407,"context_line":"                        lnum \u003d int(re.search("},{"line_number":408,"context_line":"                            \u0027iptables-restore: line ([0-9]+?) failed\u0027,"},{"line_number":409,"context_line":"                            str(r_error)).group(1))"},{"line_number":410,"context_line":"                        # get a few surrounding lines for context and put line"}],"source_content_type":"text/x-python","patch_set":10,"id":"7adec928_3fc1dc80","line":407,"in_reply_to":"7adec928_0cd07c4f","updated":"2014-05-08 18:46:06.000000000","message":"Done","commit_id":"6340997b50af479123125f92b883d8fef564401d"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"9e11e4067819aab8d791e62c375773db2ea0ecfb","unresolved":false,"context_lines":[{"line_number":406,"context_line":"                    try:"},{"line_number":407,"context_line":"                        lnum \u003d int(re.search("},{"line_number":408,"context_line":"                            \u0027iptables-restore: line ([0-9]+?) failed\u0027,"},{"line_number":409,"context_line":"                            str(r_error)).group(1))"},{"line_number":410,"context_line":"                        # get a few surrounding lines for context and put line"},{"line_number":411,"context_line":"                        # numbers on them so the offender can be identified"},{"line_number":412,"context_line":"                        log_lines \u003d [\u0027%s. %s\u0027 % (idx, l)"}],"source_content_type":"text/x-python","patch_set":10,"id":"7adec928_2c4b782c","line":409,"updated":"2014-05-08 18:10:27.000000000","message":"This is the only comment of mine on this patch that I gave -1 for.\n\nstr(r_error) looks like it might be useful enough to include in the log message.  If I saw this message, I think I would benefit from the part of the message that said which line to look on for the error.  If I don\u0027t have the debug output (which would also show me the full process input) then I\u0027d like to have that.","commit_id":"6340997b50af479123125f92b883d8fef564401d"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"0dfb88993e791618971af10301cf97bfe7fcfb5e","unresolved":false,"context_lines":[{"line_number":406,"context_line":"                    try:"},{"line_number":407,"context_line":"                        lnum \u003d int(re.search("},{"line_number":408,"context_line":"                            \u0027iptables-restore: line ([0-9]+?) failed\u0027,"},{"line_number":409,"context_line":"                            str(r_error)).group(1))"},{"line_number":410,"context_line":"                        # get a few surrounding lines for context and put line"},{"line_number":411,"context_line":"                        # numbers on them so the offender can be identified"},{"line_number":412,"context_line":"                        log_lines \u003d [\u0027%s. %s\u0027 % (idx, l)"}],"source_content_type":"text/x-python","patch_set":10,"id":"7adec928_0c607c31","line":409,"in_reply_to":"7adec928_2c4b782c","updated":"2014-05-08 18:26:05.000000000","message":"Ah, since we\u0027re under \"with...reraise...\" the exception will eventually carry the message to the log file.","commit_id":"6340997b50af479123125f92b883d8fef564401d"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"9e11e4067819aab8d791e62c375773db2ea0ecfb","unresolved":false,"context_lines":[{"line_number":409,"context_line":"                            str(r_error)).group(1))"},{"line_number":410,"context_line":"                        # get a few surrounding lines for context and put line"},{"line_number":411,"context_line":"                        # numbers on them so the offender can be identified"},{"line_number":412,"context_line":"                        log_lines \u003d [\u0027%s. %s\u0027 % (idx, l)"},{"line_number":413,"context_line":"                                     for idx, l in enumerate(all_lines)"},{"line_number":414,"context_line":"                                     if idx \u003e\u003d lnum - 2 and idx \u003c\u003d lnum + 2]"},{"line_number":415,"context_line":"                    except AttributeError:"}],"source_content_type":"text/x-python","patch_set":10,"id":"7adec928_6c62e0d9","line":412,"updated":"2014-05-08 18:10:27.000000000","message":"Consider a fixed width column for the line no if you need to crack this patch open again.","commit_id":"6340997b50af479123125f92b883d8fef564401d"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"db548d99f8eea05f722d32141aac18344e000855","unresolved":false,"context_lines":[{"line_number":409,"context_line":"                            str(r_error)).group(1))"},{"line_number":410,"context_line":"                        # get a few surrounding lines for context and put line"},{"line_number":411,"context_line":"                        # numbers on them so the offender can be identified"},{"line_number":412,"context_line":"                        log_lines \u003d [\u0027%s. %s\u0027 % (idx, l)"},{"line_number":413,"context_line":"                                     for idx, l in enumerate(all_lines)"},{"line_number":414,"context_line":"                                     if idx \u003e\u003d lnum - 2 and idx \u003c\u003d lnum + 2]"},{"line_number":415,"context_line":"                    except AttributeError:"}],"source_content_type":"text/x-python","patch_set":10,"id":"7adec928_1fc42091","line":412,"in_reply_to":"7adec928_6c62e0d9","updated":"2014-05-08 18:46:06.000000000","message":"Done","commit_id":"6340997b50af479123125f92b883d8fef564401d"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"c7bb75ff6aa9106a4b9346dc274a910ec4350eae","unresolved":false,"context_lines":[{"line_number":411,"context_line":"                        # numbers on them so the offender can be identified"},{"line_number":412,"context_line":"                        log_lines \u003d [\u0027%s. %s\u0027 % (idx, l)"},{"line_number":413,"context_line":"                                     for idx, l in enumerate(all_lines)"},{"line_number":414,"context_line":"                                     if idx \u003e\u003d lnum - 2 and idx \u003c\u003d lnum + 2]"},{"line_number":415,"context_line":"                    except AttributeError:"},{"line_number":416,"context_line":"                        # line error wasn\u0027t found, just print numbered lines"},{"line_number":417,"context_line":"                        log_lines \u003d [\u0027%s. %s\u0027 % (idx, l)"}],"source_content_type":"text/x-python","patch_set":10,"id":"7adec928_c8ff6700","line":414,"updated":"2014-05-08 13:28:59.000000000","message":"Just a \"what if\" here - but can lnum be less than 2?  I don\u0027t think it can happen but you\u0027d know better based on all the testing :)  And what happens when it is the last line?  IndexError?","commit_id":"6340997b50af479123125f92b883d8fef564401d"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"9e11e4067819aab8d791e62c375773db2ea0ecfb","unresolved":false,"context_lines":[{"line_number":411,"context_line":"                        # numbers on them so the offender can be identified"},{"line_number":412,"context_line":"                        log_lines \u003d [\u0027%s. %s\u0027 % (idx, l)"},{"line_number":413,"context_line":"                                     for idx, l in enumerate(all_lines)"},{"line_number":414,"context_line":"                                     if idx \u003e\u003d lnum - 2 and idx \u003c\u003d lnum + 2]"},{"line_number":415,"context_line":"                    except AttributeError:"},{"line_number":416,"context_line":"                        # line error wasn\u0027t found, just print numbered lines"},{"line_number":417,"context_line":"                        log_lines \u003d [\u0027%s. %s\u0027 % (idx, l)"}],"source_content_type":"text/x-python","patch_set":10,"id":"7adec928_e9fee26a","line":414,"in_reply_to":"7adec928_a8e21b9d","updated":"2014-05-08 18:10:27.000000000","message":"Agreed with Kevin, there is no index error here.  These aren\u0027t the bugs you\u0027re looking for.  Move along.  ;)","commit_id":"6340997b50af479123125f92b883d8fef564401d"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"296a7c37f86654f7c1c9ae13d23c79c7396c0e5f","unresolved":false,"context_lines":[{"line_number":411,"context_line":"                        # numbers on them so the offender can be identified"},{"line_number":412,"context_line":"                        log_lines \u003d [\u0027%s. %s\u0027 % (idx, l)"},{"line_number":413,"context_line":"                                     for idx, l in enumerate(all_lines)"},{"line_number":414,"context_line":"                                     if idx \u003e\u003d lnum - 2 and idx \u003c\u003d lnum + 2]"},{"line_number":415,"context_line":"                    except AttributeError:"},{"line_number":416,"context_line":"                        # line error wasn\u0027t found, just print numbered lines"},{"line_number":417,"context_line":"                        log_lines \u003d [\u0027%s. %s\u0027 % (idx, l)"}],"source_content_type":"text/x-python","patch_set":10,"id":"7adec928_a8e21b9d","line":414,"in_reply_to":"7adec928_c8ff6700","updated":"2014-05-08 14:01:44.000000000","message":"lnum is just used used to limit idx values, it\u0027s not used as as the list index so there shouldn\u0027t be an indexerror. All of the actual list access comes from the enumerate statement.","commit_id":"6340997b50af479123125f92b883d8fef564401d"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"0a26ab8bf470abe47b62a61ce20d5baa54d30ea4","unresolved":false,"context_lines":[{"line_number":409,"context_line":"                            str(r_error)).group(1))"},{"line_number":410,"context_line":"                        # get a few surrounding lines for context and put line"},{"line_number":411,"context_line":"                        # numbers on them so the offender can be identified"},{"line_number":412,"context_line":"                        log_lines \u003d [\u0027%7d. %s\u0027 % (idx, l)"},{"line_number":413,"context_line":"                                     for idx, l in enumerate(all_lines)"},{"line_number":414,"context_line":"                                     if line_no - 2 \u003c\u003d idx \u003c\u003d line_no + 2]"},{"line_number":415,"context_line":"                    except AttributeError:"}],"source_content_type":"text/x-python","patch_set":11,"id":"7adec928_505932fd","line":412,"updated":"2014-05-08 23:12:19.000000000","message":"(thumbsup)","commit_id":"88e6ef9b89143fffa24d0eab8d39d552854f64d7"},{"author":{"_account_id":2592,"name":"Mark McClain","email":"mark@mcclain.xyz","username":"markmcclain"},"change_message_id":"abd3ff764c1db5eee651ee4783a42318830f1621","unresolved":false,"context_lines":[{"line_number":409,"context_line":"                            str(r_error)).group(1))"},{"line_number":410,"context_line":"                        # get a few surrounding lines for context and put line"},{"line_number":411,"context_line":"                        # numbers on them so the offender can be identified"},{"line_number":412,"context_line":"                        log_lines \u003d [\u0027%7d. %s\u0027 % (idx, l)"},{"line_number":413,"context_line":"                                     for idx, l in enumerate(all_lines)"},{"line_number":414,"context_line":"                                     if line_no - 2 \u003c\u003d idx \u003c\u003d line_no + 2]"},{"line_number":415,"context_line":"                    except AttributeError:"}],"source_content_type":"text/x-python","patch_set":11,"id":"7adec928_ff5bf42b","line":412,"updated":"2014-05-21 18:58:29.000000000","message":"replace 412-422:\nCONTEXT_LINES \u003d 5\n\ntry:\n    line_no \u003d int(re.search(...).group(1))\n    context \u003d CONTEXT_LINES\nexcept AttributeError:\n    line_no \u003d 0\n    context \u003d len(all_lines)\n\n#ensure we don\u0027t go past start\n\nline_no \u003d min(0, line_no-(context//2))  # // is py33 compat\n\nlog_lines \u003d (\n    \u0027%7d: %s\u0027 % (idx, l)\n    for l in enumerate(\n        all_lines[line_no:line_no+context)], line_no)\n)\n\nLOG.error(...)","commit_id":"88e6ef9b89143fffa24d0eab8d39d552854f64d7"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"073e150c29c5044727ca0f0858e8c821af972792","unresolved":false,"context_lines":[{"line_number":411,"context_line":"                        # numbers on them so the offender can be identified"},{"line_number":412,"context_line":"                        log_lines \u003d [\u0027%7d. %s\u0027 % (idx, l)"},{"line_number":413,"context_line":"                                     for idx, l in enumerate(all_lines)"},{"line_number":414,"context_line":"                                     if line_no - 2 \u003c\u003d idx \u003c\u003d line_no + 2]"},{"line_number":415,"context_line":"                    except AttributeError:"},{"line_number":416,"context_line":"                        # line error wasn\u0027t found, just print numbered lines"},{"line_number":417,"context_line":"                        log_lines \u003d [\u0027%7d. %s\u0027 % (idx, l)"}],"source_content_type":"text/x-python","patch_set":11,"id":"7adec928_c23c9b96","line":414,"updated":"2014-05-08 19:32:56.000000000","message":"I know you put in all this code to limit the scope of what\u0027s printed, but if part of the table that\u0027s fed to iptables-restore is something like this:\n\n# Generated by iptables-save v1.4.12 on Thu May  8 15:08:24 2014\n*filter\n:INPUT ACCEPT [0:0]\n:FORWARD ACCEPT [0:0]\n:OUTPUT ACCEPT [0:0]\n:foo - [0:0]\n:bar - [0:0]\n:r2d2 - [0:0]\n:c3po - [0:0]\n:luke - [0:0]\n-A foo -j notexist\nCOMMIT\n# Completed on Thu May  8 15:08:24 2014\n\n(hopefully that doesn\u0027t get mangled by gerrit)\n\nIt\u0027s going to complain about:\n\n-A foo -j notexist\n\nIf you only print +/- two lines you won\u0027t see the failure was due to a missing chain (notexist).\n\nI know sometimes there can be thousands of rules or more when people go crazy with security group settings, so maybe if we just dump the table where the failure happened that would be enough to limit the scope?  Kind of what is above.\n\nOr we just dump everything, which is what you started with.","commit_id":"88e6ef9b89143fffa24d0eab8d39d552854f64d7"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"6e803374c0ce479ea0f9cdc805450edf77ea8637","unresolved":false,"context_lines":[{"line_number":411,"context_line":"                        # numbers on them so the offender can be identified"},{"line_number":412,"context_line":"                        log_lines \u003d [\u0027%7d. %s\u0027 % (idx, l)"},{"line_number":413,"context_line":"                                     for idx, l in enumerate(all_lines)"},{"line_number":414,"context_line":"                                     if line_no - 2 \u003c\u003d idx \u003c\u003d line_no + 2]"},{"line_number":415,"context_line":"                    except AttributeError:"},{"line_number":416,"context_line":"                        # line error wasn\u0027t found, just print numbered lines"},{"line_number":417,"context_line":"                        log_lines \u003d [\u0027%7d. %s\u0027 % (idx, l)"}],"source_content_type":"text/x-python","patch_set":11,"id":"7adec928_26f461f1","line":414,"in_reply_to":"7adec928_223fff26","updated":"2014-05-09 14:22:30.000000000","message":"As I think about this more, having the entire output is useful because a user would be able to take it, create a network namespace, and run \u0027iptables-restore \u003c input\u0027 to help debug what\u0027s wrong.\n\nBut we have to start somewhere, so I\u0027d rather get something in that we can change later if necessary.","commit_id":"88e6ef9b89143fffa24d0eab8d39d552854f64d7"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"0a26ab8bf470abe47b62a61ce20d5baa54d30ea4","unresolved":false,"context_lines":[{"line_number":411,"context_line":"                        # numbers on them so the offender can be identified"},{"line_number":412,"context_line":"                        log_lines \u003d [\u0027%7d. %s\u0027 % (idx, l)"},{"line_number":413,"context_line":"                                     for idx, l in enumerate(all_lines)"},{"line_number":414,"context_line":"                                     if line_no - 2 \u003c\u003d idx \u003c\u003d line_no + 2]"},{"line_number":415,"context_line":"                    except AttributeError:"},{"line_number":416,"context_line":"                        # line error wasn\u0027t found, just print numbered lines"},{"line_number":417,"context_line":"                        log_lines \u003d [\u0027%7d. %s\u0027 % (idx, l)"}],"source_content_type":"text/x-python","patch_set":11,"id":"7adec928_105faae6","line":414,"in_reply_to":"7adec928_223fff26","updated":"2014-05-08 23:12:19.000000000","message":"I\u0027m okay with this for now.  Kevin\u0027s explanation of the message that would result from Brian\u0027s example makes it look like it will work.","commit_id":"88e6ef9b89143fffa24d0eab8d39d552854f64d7"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"a60d1738b7231da2f7aaef95afb27f0ab5801357","unresolved":false,"context_lines":[{"line_number":411,"context_line":"                        # numbers on them so the offender can be identified"},{"line_number":412,"context_line":"                        log_lines \u003d [\u0027%7d. %s\u0027 % (idx, l)"},{"line_number":413,"context_line":"                                     for idx, l in enumerate(all_lines)"},{"line_number":414,"context_line":"                                     if line_no - 2 \u003c\u003d idx \u003c\u003d line_no + 2]"},{"line_number":415,"context_line":"                    except AttributeError:"},{"line_number":416,"context_line":"                        # line error wasn\u0027t found, just print numbered lines"},{"line_number":417,"context_line":"                        log_lines \u003d [\u0027%7d. %s\u0027 % (idx, l)"}],"source_content_type":"text/x-python","patch_set":11,"id":"7adec928_223fff26","line":414,"in_reply_to":"7adec928_c23c9b96","updated":"2014-05-08 19:55:41.000000000","message":"I suppose we need to define what we need. Even in your case iptables prints the error \"iptables-restore v1.4.12: Couldn\u0027t load target `notexist\u0027:No such file or directory\".\n\nThat including the line where it is called seems to be enough. I\u0027m inclined to start with this scoped version and then if we find out later it\u0027s throwing away useful information we can remove it.","commit_id":"88e6ef9b89143fffa24d0eab8d39d552854f64d7"}],"neutron/tests/unit/test_iptables_manager.py":[{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"b06b60b923ef4393f6c24bb96fc7f8c0ab583cea","unresolved":false,"context_lines":[{"line_number":543,"context_line":"                              self.iptables._apply_synchronized)"},{"line_number":544,"context_line":"        # error should log the input into the process to capture the"},{"line_number":545,"context_line":"        # rules being piped into iptables-restore"},{"line_number":546,"context_line":"        log.error.assert_has_calls([mock.call("},{"line_number":547,"context_line":"            \u0027IPTablesManager.apply failed to apply the \u0027"},{"line_number":548,"context_line":"            \u0027following set of iptables rules: %s\u0027,"},{"line_number":549,"context_line":"            self.execute.mock_calls[1][2][\u0027process_input\u0027]"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAW3%2F%2FpaQ%3D","line":546,"updated":"2014-04-11 12:48:47.000000000","message":"assert_called_once_with()?","commit_id":"672370e69462fefddada99fd9c7d181841b12877"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"6aced22cb4ed6b94e0a78dd5022001009c617774","unresolved":false,"context_lines":[{"line_number":543,"context_line":"                              self.iptables._apply_synchronized)"},{"line_number":544,"context_line":"        # error should log the input into the process to capture the"},{"line_number":545,"context_line":"        # rules being piped into iptables-restore"},{"line_number":546,"context_line":"        log.error.assert_has_calls([mock.call("},{"line_number":547,"context_line":"            \u0027IPTablesManager.apply failed to apply the \u0027"},{"line_number":548,"context_line":"            \u0027following set of iptables rules: %s\u0027,"},{"line_number":549,"context_line":"            self.execute.mock_calls[1][2][\u0027process_input\u0027]"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAW3%2F%2FnUc%3D","line":546,"in_reply_to":"AAAAW3%2F%2FpaQ%3D","updated":"2014-04-11 18:14:29.000000000","message":"Done","commit_id":"672370e69462fefddada99fd9c7d181841b12877"},{"author":{"_account_id":2592,"name":"Mark McClain","email":"mark@mcclain.xyz","username":"markmcclain"},"change_message_id":"20d9c4cb8c16d96fc38d76f52670ea830394c8fe","unresolved":false,"context_lines":[{"line_number":546,"context_line":"        log.error.assert_called_once_with("},{"line_number":547,"context_line":"            \u0027IPTablesManager.apply failed to apply the \u0027"},{"line_number":548,"context_line":"            \u0027following set of iptables rules:\\n%s\u0027,"},{"line_number":549,"context_line":"            self.execute.mock_calls[1][2][\u0027process_input\u0027]"},{"line_number":550,"context_line":"        )"},{"line_number":551,"context_line":""},{"line_number":552,"context_line":"    def test_get_traffic_counters_chain_notexists(self):"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAW3%2F%2Fdr0%3D","line":549,"updated":"2014-04-14 12:47:55.000000000","message":"It is a bit unusual to reference frames in another mock\u0027s call stack because of the inherent brittleness.  Either we need to use mock.ANY here or be explicit in setting the return value of the other mock. In this case, mock.ANY is acceptable since the log will coerce the value passed in as string.","commit_id":"7c7948fc88b54474d2c2a7ecde7c03f3afe1b818"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"f662215196262743258c6c51cdef6b3bcc0f8781","unresolved":false,"context_lines":[{"line_number":546,"context_line":"        log.error.assert_called_once_with("},{"line_number":547,"context_line":"            \u0027IPTablesManager.apply failed to apply the \u0027"},{"line_number":548,"context_line":"            \u0027following set of iptables rules:\\n%s\u0027,"},{"line_number":549,"context_line":"            self.execute.mock_calls[1][2][\u0027process_input\u0027]"},{"line_number":550,"context_line":"        )"},{"line_number":551,"context_line":""},{"line_number":552,"context_line":"    def test_get_traffic_counters_chain_notexists(self):"}],"source_content_type":"text/x-python","patch_set":7,"id":"9ad9bd40_aab6933b","line":549,"in_reply_to":"3a1371a2_6a0f73e2","updated":"2014-05-01 03:04:11.000000000","message":"Sorry if I\u0027m missing something, but I don\u0027t see how verifying the input to the call is any more brittle than the rest of this test. If the number or order of calls to \u0027execute\u0027 changes, it\u0027s going to break because of the ordered side effects on line 541. \n\nWhy even have this unit test if we aren\u0027t verifying that the log call is outputting something useful?\n\nI will update it to try to improve the readability though.","commit_id":"7c7948fc88b54474d2c2a7ecde7c03f3afe1b818"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"7a9d2a608c439cfe5e9d3d3d2dc32c90b4040781","unresolved":false,"context_lines":[{"line_number":546,"context_line":"        log.error.assert_called_once_with("},{"line_number":547,"context_line":"            \u0027IPTablesManager.apply failed to apply the \u0027"},{"line_number":548,"context_line":"            \u0027following set of iptables rules:\\n%s\u0027,"},{"line_number":549,"context_line":"            self.execute.mock_calls[1][2][\u0027process_input\u0027]"},{"line_number":550,"context_line":"        )"},{"line_number":551,"context_line":""},{"line_number":552,"context_line":"    def test_get_traffic_counters_chain_notexists(self):"}],"source_content_type":"text/x-python","patch_set":7,"id":"9ad9bd40_2c836c05","line":549,"in_reply_to":"9ad9bd40_aab6933b","updated":"2014-05-01 21:59:40.000000000","message":"There is good reason for the unit test even if it does not check the precise contents of the log message.  Just getting coverage on the line is valuable.  I saw a case just a few days ago where a LOG statement was mal-formed but not tests covered it.  So, it crashed an agent.  The problem escaped testing for a long time before it was discovered.\n\nIMO, releasing code with never-exercised code paths is much more of a risk than the slight chance that someone will introduce a regression later that somehow removes your inclusion of the iptables-restore input.\n\nMy $0.02\n\nMy objection before was mostly around readability.","commit_id":"7c7948fc88b54474d2c2a7ecde7c03f3afe1b818"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"056ddc4974eeb0da6fab8806ce212582cb6a5636","unresolved":false,"context_lines":[{"line_number":546,"context_line":"        log.error.assert_called_once_with("},{"line_number":547,"context_line":"            \u0027IPTablesManager.apply failed to apply the \u0027"},{"line_number":548,"context_line":"            \u0027following set of iptables rules:\\n%s\u0027,"},{"line_number":549,"context_line":"            self.execute.mock_calls[1][2][\u0027process_input\u0027]"},{"line_number":550,"context_line":"        )"},{"line_number":551,"context_line":""},{"line_number":552,"context_line":"    def test_get_traffic_counters_chain_notexists(self):"}],"source_content_type":"text/x-python","patch_set":7,"id":"3a1371a2_6a0f73e2","line":549,"in_reply_to":"AAAAW3%2F%2FY%2F8%3D","updated":"2014-04-28 20:35:23.000000000","message":"I agree that this is a bit unusual and possibly brittle.  My issue is that \"[1][2][\u0027process_input\u0027]\" is difficult to read and understand unless you\u0027re already deep in it.\n\nI\u0027m not sure the small amount of benefit gained from checking the string exactly is worth it.  I think Mock.ANY is probably enough.","commit_id":"7c7948fc88b54474d2c2a7ecde7c03f3afe1b818"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"8eddd4c42c7bcf1e17130ecba71c892aabbd1269","unresolved":false,"context_lines":[{"line_number":546,"context_line":"        log.error.assert_called_once_with("},{"line_number":547,"context_line":"            \u0027IPTablesManager.apply failed to apply the \u0027"},{"line_number":548,"context_line":"            \u0027following set of iptables rules:\\n%s\u0027,"},{"line_number":549,"context_line":"            self.execute.mock_calls[1][2][\u0027process_input\u0027]"},{"line_number":550,"context_line":"        )"},{"line_number":551,"context_line":""},{"line_number":552,"context_line":"    def test_get_traffic_counters_chain_notexists(self):"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAW3%2F%2FY%2F8%3D","line":549,"in_reply_to":"AAAAW3%2F%2FajU%3D","updated":"2014-04-14 22:43:37.000000000","message":"To elaborate a bit, I\u0027m trying to assert here that the log is dumping the same input that is being piped into the command via process_input since that\u0027s the information we are missing right now to debug these failures. \n\nThat\u0027s why I\u0027m asserting that the LOG call is being called with precisely the same input as was fed into the execute call. If the data structure does change that\u0027s okay because this will still pass as long as the LOG call is still logging what was passed into process_input like it\u0027s supposed to.","commit_id":"7c7948fc88b54474d2c2a7ecde7c03f3afe1b818"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"a9fa68c5fbdc8370e84f241d2d4c12dbbbb30ad4","unresolved":false,"context_lines":[{"line_number":546,"context_line":"        log.error.assert_called_once_with("},{"line_number":547,"context_line":"            \u0027IPTablesManager.apply failed to apply the \u0027"},{"line_number":548,"context_line":"            \u0027following set of iptables rules:\\n%s\u0027,"},{"line_number":549,"context_line":"            self.execute.mock_calls[1][2][\u0027process_input\u0027]"},{"line_number":550,"context_line":"        )"},{"line_number":551,"context_line":""},{"line_number":552,"context_line":"    def test_get_traffic_counters_chain_notexists(self):"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAW3%2F%2FajU%3D","line":549,"in_reply_to":"AAAAW3%2F%2Fdr0%3D","updated":"2014-04-14 18:22:50.000000000","message":"Line 541 does set the return value of self.execute, or am I misunderstanding your comment?","commit_id":"7c7948fc88b54474d2c2a7ecde7c03f3afe1b818"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"76c85151da9553fbbd6f2f12fc4d84797143751b","unresolved":false,"context_lines":[{"line_number":551,"context_line":"        # process that it failed to execute. Verify by comparing the log"},{"line_number":552,"context_line":"        # call to the \u0027process_input\u0027 arg given to the failed iptables-restore"},{"line_number":553,"context_line":"        # call."},{"line_number":554,"context_line":"        log.error.assert_called_once_with("},{"line_number":555,"context_line":"            \u0027IPTablesManager.apply failed to apply the \u0027"},{"line_number":556,"context_line":"            \u0027following set of iptables rules:\\n%s\u0027,"},{"line_number":557,"context_line":"            self.process_input"}],"source_content_type":"text/x-python","patch_set":9,"id":"9ad9bd40_b2a91892","line":554,"updated":"2014-05-07 10:30:56.000000000","message":"nit, no need to address... myabe you want to keep this in the with statement","commit_id":"52169bd4d525694ae4eb4095d2b161dfae1963a4"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"6b213ac6b0d0eb48e00123d1d2d4793304647595","unresolved":false,"context_lines":[{"line_number":551,"context_line":"        # process that it failed to execute. Verify by comparing the log"},{"line_number":552,"context_line":"        # call to the \u0027process_input\u0027 arg given to the failed iptables-restore"},{"line_number":553,"context_line":"        # call."},{"line_number":554,"context_line":"        log.error.assert_called_once_with("},{"line_number":555,"context_line":"            \u0027IPTablesManager.apply failed to apply the \u0027"},{"line_number":556,"context_line":"            \u0027following set of iptables rules:\\n%s\u0027,"},{"line_number":557,"context_line":"            self.process_input"}],"source_content_type":"text/x-python","patch_set":9,"id":"7adec928_cf25c20b","line":554,"in_reply_to":"9ad9bd40_b2a91892","updated":"2014-05-07 20:52:12.000000000","message":"Too much wrapping already...","commit_id":"52169bd4d525694ae4eb4095d2b161dfae1963a4"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"76c85151da9553fbbd6f2f12fc4d84797143751b","unresolved":false,"context_lines":[{"line_number":553,"context_line":"        # call."},{"line_number":554,"context_line":"        log.error.assert_called_once_with("},{"line_number":555,"context_line":"            \u0027IPTablesManager.apply failed to apply the \u0027"},{"line_number":556,"context_line":"            \u0027following set of iptables rules:\\n%s\u0027,"},{"line_number":557,"context_line":"            self.process_input"},{"line_number":558,"context_line":"        )"},{"line_number":559,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"9ad9bd40_12948441","line":556,"updated":"2014-05-07 10:30:56.000000000","message":"More pedantry for you... I would just check process_input has been logged. The exact text is probably not interesting; if one changes the text of a log statement he/she should not be forced to change also the relevant unit test (also idk how this works with i18n if one runs tests in an environment with a different language, but probably this aspect does not matter)","commit_id":"52169bd4d525694ae4eb4095d2b161dfae1963a4"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"6b213ac6b0d0eb48e00123d1d2d4793304647595","unresolved":false,"context_lines":[{"line_number":553,"context_line":"        # call."},{"line_number":554,"context_line":"        log.error.assert_called_once_with("},{"line_number":555,"context_line":"            \u0027IPTablesManager.apply failed to apply the \u0027"},{"line_number":556,"context_line":"            \u0027following set of iptables rules:\\n%s\u0027,"},{"line_number":557,"context_line":"            self.process_input"},{"line_number":558,"context_line":"        )"},{"line_number":559,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"7adec928_ef0fde2c","line":556,"in_reply_to":"9ad9bd40_12948441","updated":"2014-05-07 20:52:12.000000000","message":"Why does everyone hate me testing this so much? :-)\n\nIf it were just a fixed string, I would agree. But it is dynamically generated and the usefulness depends on the input, so I demand it be tested!\n\nThe language should be addressed by me adding the translator.","commit_id":"52169bd4d525694ae4eb4095d2b161dfae1963a4"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"9e11e4067819aab8d791e62c375773db2ea0ecfb","unresolved":false,"context_lines":[{"line_number":558,"context_line":"        logged \u003d [\u0027%s. %s\u0027 % (n, l) for n, l in enumerate(self.input_lines)]"},{"line_number":559,"context_line":"        log.error.assert_called_once_with(_("},{"line_number":560,"context_line":"            \u0027IPTablesManager.apply failed to apply the \u0027"},{"line_number":561,"context_line":"            \u0027following set of iptables rules:\\n%s\u0027),"},{"line_number":562,"context_line":"            \u0027\\n\u0027.join(logged)"},{"line_number":563,"context_line":"        )"},{"line_number":564,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"7adec928_09730eea","line":561,"updated":"2014-05-08 18:10:27.000000000","message":"I still agree with Salvatore on this but not enough for a -1.  Go for it!  I\u0027ll still +1 with this.\n\nThe most benefit of this test will come from simply running through the code path.  Marginal benefit is achieved by testing the precise contents of the log message.  My $0.02.","commit_id":"6340997b50af479123125f92b883d8fef564401d"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"9e11e4067819aab8d791e62c375773db2ea0ecfb","unresolved":false,"context_lines":[{"line_number":589,"context_line":"        log.error.assert_called_once_with(_("},{"line_number":590,"context_line":"            \u0027IPTablesManager.apply failed to apply the \u0027"},{"line_number":591,"context_line":"            \u0027following set of iptables rules:\\n%s\u0027),"},{"line_number":592,"context_line":"            \u0027\\n\u0027.join(logged)"},{"line_number":593,"context_line":"        )"},{"line_number":594,"context_line":""},{"line_number":595,"context_line":"    def test_get_traffic_counters_chain_notexists(self):"}],"source_content_type":"text/x-python","patch_set":10,"id":"7adec928_2c3a98cd","line":592,"updated":"2014-05-08 18:10:27.000000000","message":"Here, checking that the right lines are included is of a little more importance than above because it is checking some extra logic in the code.","commit_id":"6340997b50af479123125f92b883d8fef564401d"}]}
