)]}'
{"etc/neutron/rootwrap.d/l3.filters":[{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"f656bcb67552be08f3e41d0d5df2f528fa2dc418","unresolved":false,"context_lines":[{"line_number":54,"context_line":"# For creating namespace local /etc"},{"line_number":55,"context_line":"rt_tables_mkdir: RegExpFilter, /bin/mkdir, root, mkdir, -p, /etc/netns/qrouter-[^/]*"},{"line_number":56,"context_line":"rt_tables_chown: RegExpFilter, /bin/chown, root, chown, [1-9][0-9]*, /etc/netns/qrouter-[^/]*"},{"line_number":57,"context_line":"rt_tables_rmdir: RegExpFilter, /bin/rmdir, root, rmdir, -p, /etc/netns/qrouter-[^/]*"}],"source_content_type":"application/octet-stream","patch_set":22,"id":"ba8a016a_69d56d1a","line":57,"updated":"2015-11-18 11:10:22.000000000","message":"I don\u0027t think you want the -p parameter here.","commit_id":"8bf93d7b7e7937dd74d3cce07a0e300aa2096d1c"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"f679e0baa4210ef771e7d48068a7e5fcd961bdb9","unresolved":false,"context_lines":[{"line_number":54,"context_line":"# For creating namespace local /etc"},{"line_number":55,"context_line":"rt_tables_mkdir: RegExpFilter, /bin/mkdir, root, mkdir, -p, /etc/netns/qrouter-[^/]*"},{"line_number":56,"context_line":"rt_tables_chown: RegExpFilter, /bin/chown, root, chown, [1-9][0-9]*, /etc/netns/qrouter-[^/]*"},{"line_number":57,"context_line":"rt_tables_rmdir: RegExpFilter, /bin/rmdir, root, rmdir, -p, /etc/netns/qrouter-[^/]*"}],"source_content_type":"application/octet-stream","patch_set":22,"id":"ba8a016a_b61f0c07","line":57,"in_reply_to":"ba8a016a_0f6b6c86","updated":"2015-11-18 22:08:43.000000000","message":"if you\u0027re anything like me, you did copy \u0026 paste","commit_id":"8bf93d7b7e7937dd74d3cce07a0e300aa2096d1c"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"6be642e67f17ace742dac03f538ffb9408e407b0","unresolved":false,"context_lines":[{"line_number":54,"context_line":"# For creating namespace local /etc"},{"line_number":55,"context_line":"rt_tables_mkdir: RegExpFilter, /bin/mkdir, root, mkdir, -p, /etc/netns/qrouter-[^/]*"},{"line_number":56,"context_line":"rt_tables_chown: RegExpFilter, /bin/chown, root, chown, [1-9][0-9]*, /etc/netns/qrouter-[^/]*"},{"line_number":57,"context_line":"rt_tables_rmdir: RegExpFilter, /bin/rmdir, root, rmdir, -p, /etc/netns/qrouter-[^/]*"}],"source_content_type":"application/octet-stream","patch_set":22,"id":"ba8a016a_0f6b6c86","line":57,"in_reply_to":"ba8a016a_69d56d1a","updated":"2015-11-18 17:23:03.000000000","message":"How\u0027d that get there?  Good catch!","commit_id":"8bf93d7b7e7937dd74d3cce07a0e300aa2096d1c"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"082d078cd5f6e92ff0b9108dfbed152fbff25f20","unresolved":false,"context_lines":[{"line_number":54,"context_line":"# For creating namespace local /etc"},{"line_number":55,"context_line":"rt_tables_mkdir: RegExpFilter, /bin/mkdir, root, mkdir, -p, /etc/netns/qrouter-[^/]*"},{"line_number":56,"context_line":"rt_tables_chown: RegExpFilter, /bin/chown, root, chown, [1-9][0-9]*, /etc/netns/qrouter-[^/]*"},{"line_number":57,"context_line":"rt_tables_rmdir: RegExpFilter, /bin/rmdir, root, rmdir, -p, /etc/netns/qrouter-[^/]*"}],"source_content_type":"application/octet-stream","patch_set":22,"id":"9a8ffd7b_51167056","line":57,"in_reply_to":"ba8a016a_b61f0c07","updated":"2015-12-01 19:01:29.000000000","message":"Done","commit_id":"8bf93d7b7e7937dd74d3cce07a0e300aa2096d1c"},{"author":{"_account_id":9551,"name":"Martin Hickey","email":"martin.hickey@ie.ibm.com","username":"mhickey"},"change_message_id":"cb11f3c8e174778b8bead010630f1f4b9eca46ec","unresolved":false,"context_lines":[{"line_number":54,"context_line":"# For creating namespace local /etc"},{"line_number":55,"context_line":"rt_tables_mkdir: RegExpFilter, /bin/mkdir, root, mkdir, -p, /etc/netns/qrouter-[^/]*"},{"line_number":56,"context_line":"rt_tables_chown: RegExpFilter, /bin/chown, root, chown, [1-9][0-9]*, /etc/netns/qrouter-[^/]*"},{"line_number":57,"context_line":"rt_tables_rmdir: RegExpFilter, /bin/rmdir, root, rmdir, -p, /etc/netns/qrouter-[^/]*"}],"source_content_type":"application/octet-stream","patch_set":24,"id":"9a8ffd7b_3f6db304","line":57,"updated":"2015-11-24 20:59:58.000000000","message":"Was the \u0027-p\u0027 parameter mentioned in previous review comment to be removed?","commit_id":"d9977949b2ff62340130f4c885a27a8828611108"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"a101be777c2c78965f82575228107aa658534afc","unresolved":false,"context_lines":[{"line_number":54,"context_line":"# For creating namespace local /etc"},{"line_number":55,"context_line":"rt_tables_mkdir: RegExpFilter, /bin/mkdir, root, mkdir, -p, /etc/netns/qrouter-[^/]*"},{"line_number":56,"context_line":"rt_tables_chown: RegExpFilter, /bin/chown, root, chown, [1-9][0-9]*, /etc/netns/qrouter-[^/]*"},{"line_number":57,"context_line":"rt_tables_rmdir: RegExpFilter, /bin/rmdir, root, rmdir, -p, /etc/netns/qrouter-[^/]*"}],"source_content_type":"application/octet-stream","patch_set":24,"id":"9a8ffd7b_406d3803","line":57,"in_reply_to":"9a8ffd7b_3f6db304","updated":"2015-11-24 22:13:14.000000000","message":"I haven\u0027t had a chance to go through all of the feedback for this patch.  Sorry.","commit_id":"d9977949b2ff62340130f4c885a27a8828611108"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"95e6f113ad34664ca49a5f13d4bf20904667dbc2","unresolved":false,"context_lines":[{"line_number":54,"context_line":"# For creating namespace local /etc"},{"line_number":55,"context_line":"rt_tables_mkdir: RegExpFilter, /bin/mkdir, root, mkdir, -p, /etc/netns/qrouter-[^/]*"},{"line_number":56,"context_line":"rt_tables_chown: RegExpFilter, /bin/chown, root, chown, [1-9][0-9]*, /etc/netns/qrouter-[^/]*"},{"line_number":57,"context_line":"rt_tables_rmdir: RegExpFilter, /bin/rmdir, root, rm, -rf, /etc/netns/qrouter-[^/]*"}],"source_content_type":"application/octet-stream","patch_set":26,"id":"7a740942_fd78b391","line":57,"updated":"2015-12-03 16:32:15.000000000","message":"Don\u0027t think you need the /bin here","commit_id":"92b97fdc53cd6cfc997294d6bd4b42d0bf7b4ca0"},{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"0620b6cc3915ce9d19a201244e55ea529d4d6e7e","unresolved":false,"context_lines":[{"line_number":54,"context_line":"# For creating namespace local /etc"},{"line_number":55,"context_line":"rt_tables_mkdir: RegExpFilter, /bin/mkdir, root, mkdir, -p, /etc/netns/qrouter-[^/]*"},{"line_number":56,"context_line":"rt_tables_chown: RegExpFilter, /bin/chown, root, chown, [1-9][0-9]*, /etc/netns/qrouter-[^/]*"},{"line_number":57,"context_line":"rt_tables_rmdir: RegExpFilter, /bin/rmdir, root, rm, -rf, /etc/netns/qrouter-[^/]*"}],"source_content_type":"application/octet-stream","patch_set":28,"id":"7a740942_25f327a0","line":57,"updated":"2015-12-05 16:13:23.000000000","message":"As Brian Haley mentioned, /bin may not be needed here. Besides, it should be \"/bin/rm\" here.","commit_id":"26633e18d1f24e8fe86b9d77ed001da46e9cb149"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"927a5f716e87257eea492c2dc0d1989e9e455e78","unresolved":false,"context_lines":[{"line_number":54,"context_line":"# For creating namespace local /etc"},{"line_number":55,"context_line":"rt_tables_mkdir: RegExpFilter, /bin/mkdir, root, mkdir, -p, /etc/netns/qrouter-[^/]*"},{"line_number":56,"context_line":"rt_tables_chown: RegExpFilter, /bin/chown, root, chown, [1-9][0-9]*, /etc/netns/qrouter-[^/]*"},{"line_number":57,"context_line":"rt_tables_rmdir: RegExpFilter, /bin/rmdir, root, rm, -rf, /etc/netns/qrouter-[^/]*"}],"source_content_type":"application/octet-stream","patch_set":28,"id":"7a740942_45a87020","line":57,"in_reply_to":"7a740942_25f327a0","updated":"2015-12-07 22:12:22.000000000","message":"Good catch, I\u0027ll fix it now.","commit_id":"26633e18d1f24e8fe86b9d77ed001da46e9cb149"},{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"770a19ff6036597cba81d43834394107a7edafd1","unresolved":false,"context_lines":[{"line_number":54,"context_line":"# For creating namespace local /etc"},{"line_number":55,"context_line":"rt_tables_mkdir: RegExpFilter, mkdir, root, mkdir, -p, /etc/netns/qrouter-[^/].*"},{"line_number":56,"context_line":"rt_tables_chown: RegExpFilter, chown, root, chown, [1-9][0-9].*, /etc/netns/qrouter-[^/].*"},{"line_number":57,"context_line":"rt_tables_rmdir: RegExpFilter, rm, root, rm, -rf, /etc/netns/qrouter-[^/].*"}],"source_content_type":"application/octet-stream","patch_set":37,"id":"1a7b0d38_7e1259b6","line":57,"range":{"start_line":57,"start_character":44,"end_line":57,"end_character":45},"updated":"2015-12-23 09:52:37.000000000","message":"Since the command changed in rt_tables.py, it should be \"rm, -r, -f\" here, otherwise, the dependent code will break. I will update this in next version.","commit_id":"b7151e4f4591e35258036c33f6e219547aa2730e"}],"neutron/agent/l3/rt_tables.py":[{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"a4f3b7b5076d38fb1a40b0ae8fa5fb6a88d359f5","unresolved":false,"context_lines":[{"line_number":1,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"},{"line_number":2,"context_line":"#    not use this file except in compliance with the License. You may obtain"},{"line_number":3,"context_line":"#    a copy of the License at"},{"line_number":4,"context_line":"#"}],"source_content_type":"text/x-python","patch_set":2,"id":"fa32b979_b1a3b1b1","line":1,"updated":"2015-06-17 13:05:10.000000000","message":"it should not be in neutron.agent.linux package like ip_lib, iptables_manager?","commit_id":"92d6cdd7c44c436c88dd52d7fdb4c3322eb66318"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"ade9153648d56a093080fc34edf571fb1725c042","unresolved":false,"context_lines":[{"line_number":1,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"},{"line_number":2,"context_line":"#    not use this file except in compliance with the License. You may obtain"},{"line_number":3,"context_line":"#    a copy of the License at"},{"line_number":4,"context_line":"#"}],"source_content_type":"text/x-python","patch_set":2,"id":"fa32b979_b253936a","line":1,"in_reply_to":"fa32b979_b1a3b1b1","updated":"2015-06-17 22:49:10.000000000","message":"I suppose I could do that.  It just seemed so L3 agent specific to me.  What do others think?","commit_id":"92d6cdd7c44c436c88dd52d7fdb4c3322eb66318"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"a4f3b7b5076d38fb1a40b0ae8fa5fb6a88d359f5","unresolved":false,"context_lines":[{"line_number":123,"context_line":"    def _write_map(self, name_to_id):"},{"line_number":124,"context_line":"        with open(self._rt_tables_filename, \"w\") as rt_file:"},{"line_number":125,"context_line":"            for name, table_id in name_to_id.items():"},{"line_number":126,"context_line":"                rt_file.write(\"%s\t%s\\n\" % (table_id, name))"},{"line_number":127,"context_line":""},{"line_number":128,"context_line":"    def _read_map(self):"},{"line_number":129,"context_line":"        with open(self._rt_tables_filename, \"r\") as rt_file:"}],"source_content_type":"text/x-python","patch_set":2,"id":"fa32b979_51d105f9","line":126,"updated":"2015-06-17 13:05:10.000000000","message":"prefer \\t over a \"real\" tab","commit_id":"92d6cdd7c44c436c88dd52d7fdb4c3322eb66318"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"ade9153648d56a093080fc34edf571fb1725c042","unresolved":false,"context_lines":[{"line_number":123,"context_line":"    def _write_map(self, name_to_id):"},{"line_number":124,"context_line":"        with open(self._rt_tables_filename, \"w\") as rt_file:"},{"line_number":125,"context_line":"            for name, table_id in name_to_id.items():"},{"line_number":126,"context_line":"                rt_file.write(\"%s\t%s\\n\" % (table_id, name))"},{"line_number":127,"context_line":""},{"line_number":128,"context_line":"    def _read_map(self):"},{"line_number":129,"context_line":"        with open(self._rt_tables_filename, \"r\") as rt_file:"}],"source_content_type":"text/x-python","patch_set":2,"id":"fa32b979_524c87c7","line":126,"in_reply_to":"fa32b979_51d105f9","updated":"2015-06-17 22:49:10.000000000","message":"Done","commit_id":"92d6cdd7c44c436c88dd52d7fdb4c3322eb66318"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"153511b37f4ec952271249c8520e37325add79ee","unresolved":false,"context_lines":[{"line_number":76,"context_line":"    the address scope on the command line manually."},{"line_number":77,"context_line":"    \"\"\""},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"    FILENAME \u003d \u0027rt_tables\u0027"},{"line_number":80,"context_line":"    ALL_IDS \u003d set(range(1024, 2048))"},{"line_number":81,"context_line":""},{"line_number":82,"context_line":"    def __init__(self, namespace):"}],"source_content_type":"text/x-python","patch_set":4,"id":"fa32b979_eaf17b6b","line":79,"updated":"2015-06-22 22:46:46.000000000","message":"\u0027iproute2/rt_tables\u0027","commit_id":"866471d720719e907ac8f082b21ae04247fe9804"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"153511b37f4ec952271249c8520e37325add79ee","unresolved":false,"context_lines":[{"line_number":85,"context_line":"        # think we should probably revert to a file under state_path"},{"line_number":86,"context_line":"        self.etc \u003d NamespaceEtcDir(namespace)"},{"line_number":87,"context_line":"        self._rt_tables_filename \u003d os.path.join("},{"line_number":88,"context_line":"            self.etc.get_full_path(), self.FILENAME)"},{"line_number":89,"context_line":"        self._lockname \u003d \u0027rt_tables-%s\u0027 % namespace"},{"line_number":90,"context_line":""},{"line_number":91,"context_line":"        # Create a default table if one is not already found"}],"source_content_type":"text/x-python","patch_set":4,"id":"fa32b979_2af8c348","line":88,"updated":"2015-06-22 22:46:46.000000000","message":"ensure_dir(os.path.dirname(self._rt_tables_filename))","commit_id":"866471d720719e907ac8f082b21ae04247fe9804"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"153511b37f4ec952271249c8520e37325add79ee","unresolved":false,"context_lines":[{"line_number":98,"context_line":"                              \"unspec\": 0}"},{"line_number":99,"context_line":"                self._write_map(name_to_id)"},{"line_number":100,"context_line":""},{"line_number":101,"context_line":"    def get_table(self, address_scope_id):"},{"line_number":102,"context_line":"        \"\"\"Returns the table ID for the given scope\"\"\""},{"line_number":103,"context_line":"        with lockutils.lock(self._lockname):"},{"line_number":104,"context_line":"            for table_id, name in self._read_map():"}],"source_content_type":"text/x-python","patch_set":4,"id":"fa32b979_fc038db6","line":101,"updated":"2015-06-22 22:46:46.000000000","message":"Maybe this could just be \"get\"","commit_id":"866471d720719e907ac8f082b21ae04247fe9804"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"153511b37f4ec952271249c8520e37325add79ee","unresolved":false,"context_lines":[{"line_number":105,"context_line":"                if name \u003d\u003d address_scope_id:"},{"line_number":106,"context_line":"                    return RoutingTable(table_id, address_scope_id)"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"    def get_tables(self):"},{"line_number":109,"context_line":"        with lockutils.lock(self._lockname):"},{"line_number":110,"context_line":"            return set(RoutingTable(t_id, name)"},{"line_number":111,"context_line":"                       for t_id, name in self._read_map())"}],"source_content_type":"text/x-python","patch_set":4,"id":"fa32b979_1ced11ef","line":108,"updated":"2015-06-22 22:46:46.000000000","message":"Maybe \"get_all\"","commit_id":"866471d720719e907ac8f082b21ae04247fe9804"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"153511b37f4ec952271249c8520e37325add79ee","unresolved":false,"context_lines":[{"line_number":110,"context_line":"            return set(RoutingTable(t_id, name)"},{"line_number":111,"context_line":"                       for t_id, name in self._read_map())"},{"line_number":112,"context_line":""},{"line_number":113,"context_line":"    def add_address_scope(self, address_scope_id):"},{"line_number":114,"context_line":"        \"\"\"Ensures that there is a single table id available for the scope\"\"\""},{"line_number":115,"context_line":"        with lockutils.lock(self._lockname):"},{"line_number":116,"context_line":"            name_to_id \u003d {name: t_id for t_id, name in self._read_map()}"}],"source_content_type":"text/x-python","patch_set":4,"id":"fa32b979_bc0505c3","line":113,"updated":"2015-06-22 22:46:46.000000000","message":"Maybe this could just be \"add\"","commit_id":"866471d720719e907ac8f082b21ae04247fe9804"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"153511b37f4ec952271249c8520e37325add79ee","unresolved":false,"context_lines":[{"line_number":117,"context_line":""},{"line_number":118,"context_line":"            # If it is already there, just return it."},{"line_number":119,"context_line":"            if address_scope_id in name_to_id:"},{"line_number":120,"context_line":"                return name_to_id[address_scope_id]"},{"line_number":121,"context_line":""},{"line_number":122,"context_line":"            # Otherwise, find an available id and write the new file"},{"line_number":123,"context_line":"            table_ids \u003d set(name_to_id.values())"}],"source_content_type":"text/x-python","patch_set":4,"id":"fa32b979_0a94dfdf","line":120,"updated":"2015-06-22 22:46:46.000000000","message":"return RoutingTable(...)","commit_id":"866471d720719e907ac8f082b21ae04247fe9804"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"153511b37f4ec952271249c8520e37325add79ee","unresolved":false,"context_lines":[{"line_number":126,"context_line":"            self._write_map(name_to_id)"},{"line_number":127,"context_line":"            return RoutingTable(table_id, address_scope_id)"},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"    def delete_address_scope(self, address_scope_id):"},{"line_number":130,"context_line":"        \"\"\"Removes the address scope from the file\"\"\""},{"line_number":131,"context_line":"        with lockutils.lock(self._lockname):"},{"line_number":132,"context_line":"            name_to_id \u003d {name: t_id for t_id, name in self._read_map()}"}],"source_content_type":"text/x-python","patch_set":4,"id":"fa32b979_1c68b186","line":129,"updated":"2015-06-22 22:46:46.000000000","message":"\"delete\"","commit_id":"866471d720719e907ac8f082b21ae04247fe9804"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"4f60b362e42108bacfb4ea4956f9b002c83109b0","unresolved":false,"context_lines":[{"line_number":1,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"},{"line_number":2,"context_line":"#    not use this file except in compliance with the License. You may obtain"},{"line_number":3,"context_line":"#    a copy of the License at"},{"line_number":4,"context_line":"#"}],"source_content_type":"text/x-python","patch_set":5,"id":"ba3cc151_989bbb72","line":1,"updated":"2015-07-05 15:58:51.000000000","message":"Just noticed that you\u0027ve copyrighted the unit tests file but not the other. For your consideration :)","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"4892202178c328ea7fb233e45b57158d617b7cb1","unresolved":false,"context_lines":[{"line_number":1,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"},{"line_number":2,"context_line":"#    not use this file except in compliance with the License. You may obtain"},{"line_number":3,"context_line":"#    a copy of the License at"},{"line_number":4,"context_line":"#"}],"source_content_type":"text/x-python","patch_set":5,"id":"ba3cc151_01eb8879","line":1,"in_reply_to":"ba3cc151_989bbb72","updated":"2015-07-06 22:38:26.000000000","message":"See comment in the other file.","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"4f60b362e42108bacfb4ea4956f9b002c83109b0","unresolved":false,"context_lines":[{"line_number":31,"context_line":""},{"line_number":32,"context_line":"    BASE_DIR \u003d \"/etc/netns\""},{"line_number":33,"context_line":""},{"line_number":34,"context_line":"    def __init__(self, namespace):"},{"line_number":35,"context_line":"        directory \u003d os.path.join(self.BASE_DIR, namespace)"},{"line_number":36,"context_line":"        linux_utils.execute([\"mkdir\", \"-p\", directory], run_as_root\u003dTrue)"},{"line_number":37,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"ba3cc151_f80d27e9","line":34,"updated":"2015-07-05 15:58:51.000000000","message":"We should avoid interacting with the system on object __init__. I\u0027d recommend __init__ just setting self._directory and adding a create method that calls mkdir.","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"9e5a4ffc63b1b2eb2dbf344f3628a160d1d62538","unresolved":false,"context_lines":[{"line_number":31,"context_line":""},{"line_number":32,"context_line":"    BASE_DIR \u003d \"/etc/netns\""},{"line_number":33,"context_line":""},{"line_number":34,"context_line":"    def __init__(self, namespace):"},{"line_number":35,"context_line":"        directory \u003d os.path.join(self.BASE_DIR, namespace)"},{"line_number":36,"context_line":"        linux_utils.execute([\"mkdir\", \"-p\", directory], run_as_root\u003dTrue)"},{"line_number":37,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"9a8ffd7b_b940e836","line":34,"in_reply_to":"ba3cc151_f80d27e9","updated":"2015-11-30 23:04:10.000000000","message":"Done","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"6e721c147d6493a80a5473a3286bc2a81763116e","unresolved":false,"context_lines":[{"line_number":40,"context_line":"        self._directory \u003d directory"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    def destroy(self):"},{"line_number":43,"context_line":"        linux_utils.execute([\"rmdir\", self._directory], run_as_root\u003dTrue)"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    def get_full_path(self):"},{"line_number":46,"context_line":"        return self._directory"}],"source_content_type":"text/x-python","patch_set":5,"id":"fa32b979_5d82b001","line":43,"updated":"2015-06-23 00:42:00.000000000","message":"It looks like below you create files in this directory, so does this need to be \u0027rm -r\u0027 instead?","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"9e5a4ffc63b1b2eb2dbf344f3628a160d1d62538","unresolved":false,"context_lines":[{"line_number":40,"context_line":"        self._directory \u003d directory"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    def destroy(self):"},{"line_number":43,"context_line":"        linux_utils.execute([\"rmdir\", self._directory], run_as_root\u003dTrue)"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    def get_full_path(self):"},{"line_number":46,"context_line":"        return self._directory"}],"source_content_type":"text/x-python","patch_set":5,"id":"9a8ffd7b_d947ec1b","line":43,"in_reply_to":"ba3cc151_911a347c","updated":"2015-11-30 23:04:10.000000000","message":"Done","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":17096,"name":"Aditi Rajagopal","email":"arajagopal@us.ibm.com","username":"aditirajagopal"},"change_message_id":"68074ce533e00300377e5f9957a6deb04cc5c9b3","unresolved":false,"context_lines":[{"line_number":40,"context_line":"        self._directory \u003d directory"},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"    def destroy(self):"},{"line_number":43,"context_line":"        linux_utils.execute([\"rmdir\", self._directory], run_as_root\u003dTrue)"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    def get_full_path(self):"},{"line_number":46,"context_line":"        return self._directory"}],"source_content_type":"text/x-python","patch_set":5,"id":"ba3cc151_911a347c","line":43,"in_reply_to":"fa32b979_5d82b001","updated":"2015-07-01 16:52:54.000000000","message":"Yes, \"rmdir\" is used to delete empty directories. In this case if there are files in the directory, this would fail (see http://ss64.com/bash/rmdir.html). You would need to run \"rm -r\" to remove the files within the directory (recursively) in addition to the directory","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"7e474906a55ddb75b5357f0d1b00ef293fcee2c1","unresolved":false,"context_lines":[{"line_number":58,"context_line":"        return self.table_id"},{"line_number":59,"context_line":""},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"class RoutingTablesManager(object):"},{"line_number":62,"context_line":"    \"\"\"Manages mapping from address scope to routing tables"},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"    The iproute2 package can read a mapping from /etc/iproute2/rt_tables."}],"source_content_type":"text/x-python","patch_set":5,"id":"ba3cc151_38114fb0","line":61,"updated":"2015-07-05 16:44:00.000000000","message":"Here\u0027s a thought - There\u0027s nothing essentially not-generic, or that ties this class to address scopes, apart from some variable names and the doctext. I\u0027d rather move this class under agent/linux and rename some variables from address_scope_id to (For example) routing_table_name.","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"9e5a4ffc63b1b2eb2dbf344f3628a160d1d62538","unresolved":false,"context_lines":[{"line_number":58,"context_line":"        return self.table_id"},{"line_number":59,"context_line":""},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"class RoutingTablesManager(object):"},{"line_number":62,"context_line":"    \"\"\"Manages mapping from address scope to routing tables"},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"    The iproute2 package can read a mapping from /etc/iproute2/rt_tables."}],"source_content_type":"text/x-python","patch_set":5,"id":"9a8ffd7b_39039878","line":61,"in_reply_to":"ba3cc151_38114fb0","updated":"2015-11-30 23:04:10.000000000","message":"Done","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"4f60b362e42108bacfb4ea4956f9b002c83109b0","unresolved":false,"context_lines":[{"line_number":61,"context_line":"class RoutingTablesManager(object):"},{"line_number":62,"context_line":"    \"\"\"Manages mapping from address scope to routing tables"},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"    The iproute2 package can read a mapping from /etc/iproute2/rt_tables."},{"line_number":65,"context_line":"    Since this file is shared between namespaces, it would be a bit"},{"line_number":66,"context_line":"    presumptious to use this system-wide file.  However, for namespaces, it is"},{"line_number":67,"context_line":"    possible to maintain an rt_tables file that is private to the namespace."}],"source_content_type":"text/x-python","patch_set":5,"id":"ba3cc151_f8244761","line":64,"updated":"2015-07-05 15:58:51.000000000","message":"Can you shorten this paragraph to simply explain that the rt_tables can be made unique per namespace?","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"9e5a4ffc63b1b2eb2dbf344f3628a160d1d62538","unresolved":false,"context_lines":[{"line_number":61,"context_line":"class RoutingTablesManager(object):"},{"line_number":62,"context_line":"    \"\"\"Manages mapping from address scope to routing tables"},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"    The iproute2 package can read a mapping from /etc/iproute2/rt_tables."},{"line_number":65,"context_line":"    Since this file is shared between namespaces, it would be a bit"},{"line_number":66,"context_line":"    presumptious to use this system-wide file.  However, for namespaces, it is"},{"line_number":67,"context_line":"    possible to maintain an rt_tables file that is private to the namespace."}],"source_content_type":"text/x-python","patch_set":5,"id":"9a8ffd7b_f96bd0ef","line":64,"in_reply_to":"ba3cc151_f8244761","updated":"2015-11-30 23:04:10.000000000","message":"Done","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"4f60b362e42108bacfb4ea4956f9b002c83109b0","unresolved":false,"context_lines":[{"line_number":91,"context_line":"        self._lockname \u003d \u0027rt_tables-%s\u0027 % namespace"},{"line_number":92,"context_line":""},{"line_number":93,"context_line":"        # Create a default table if one is not already found"},{"line_number":94,"context_line":"        with lockutils.lock(self._lockname):"},{"line_number":95,"context_line":"            if not os.path.exists(self._rt_tables_filename):"},{"line_number":96,"context_line":"                # Add the regular tables one expects to see by default"},{"line_number":97,"context_line":"                name_to_id \u003d {\"local\": 255,"}],"source_content_type":"text/x-python","patch_set":5,"id":"ba3cc151_586213af","line":94,"updated":"2015-07-05 15:58:51.000000000","message":"I\u0027m afraid I might be missing something important. Why is this lock needed? The L3 agent guarantees that the same router (Thus same namespace and same rt_tables file) can only be serially updated, i.e. two update operations for the same router are performed serially.\n\nThat being said, can you add external\u003dTrue to the lock? This will avoid issues in full stack tests when we have multiple copies of the L3 agent running on the same machine, and for an HA router, all accessing the same file at possibly the same time.","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"9e5a4ffc63b1b2eb2dbf344f3628a160d1d62538","unresolved":false,"context_lines":[{"line_number":91,"context_line":"        self._lockname \u003d \u0027rt_tables-%s\u0027 % namespace"},{"line_number":92,"context_line":""},{"line_number":93,"context_line":"        # Create a default table if one is not already found"},{"line_number":94,"context_line":"        with lockutils.lock(self._lockname):"},{"line_number":95,"context_line":"            if not os.path.exists(self._rt_tables_filename):"},{"line_number":96,"context_line":"                # Add the regular tables one expects to see by default"},{"line_number":97,"context_line":"                name_to_id \u003d {\"local\": 255,"}],"source_content_type":"text/x-python","patch_set":5,"id":"9a8ffd7b_d95a8c50","line":94,"in_reply_to":"ba3cc151_586213af","updated":"2015-11-30 23:04:10.000000000","message":"I don\u0027t think a lock should be needed.","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"4f60b362e42108bacfb4ea4956f9b002c83109b0","unresolved":false,"context_lines":[{"line_number":100,"context_line":"                              \"unspec\": 0}"},{"line_number":101,"context_line":"                self._write_map(name_to_id)"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    def _table_name(self, address_scope_id):"},{"line_number":104,"context_line":"        if address_scope_id is None:"},{"line_number":105,"context_line":"            return constants.L3_DEFAULT_ROUTING_TABLE"},{"line_number":106,"context_line":"        return address_scope_id"}],"source_content_type":"text/x-python","patch_set":5,"id":"ba3cc151_d8e38304","line":103,"updated":"2015-07-05 15:58:51.000000000","message":"I see this is used in get below. I don\u0027t have the context in your head as for how this class will be used in follow up patches: What would you expect to happen when the caller calls get(None)? Is this an expected case, why does it make sense? (I\u0027m asking because you seem to be handling and not raising an exception and I wonder why. If the address scope is None why aren\u0027t we defaulting to the main routing table instead of a table called \"noscope\"?).","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"9e5a4ffc63b1b2eb2dbf344f3628a160d1d62538","unresolved":false,"context_lines":[{"line_number":100,"context_line":"                              \"unspec\": 0}"},{"line_number":101,"context_line":"                self._write_map(name_to_id)"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    def _table_name(self, address_scope_id):"},{"line_number":104,"context_line":"        if address_scope_id is None:"},{"line_number":105,"context_line":"            return constants.L3_DEFAULT_ROUTING_TABLE"},{"line_number":106,"context_line":"        return address_scope_id"}],"source_content_type":"text/x-python","patch_set":5,"id":"9a8ffd7b_94b5ab32","line":103,"in_reply_to":"ba3cc151_d8e38304","updated":"2015-11-30 23:04:10.000000000","message":"We can\u0027t use the main routing table for no scope because that routing table automatically gets routes for all of the devices.  With that said, I understand what you\u0027re saying, especially given that you want this class to be less specialized for address scopes.  Let me see what I can do.","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"4f60b362e42108bacfb4ea4956f9b002c83109b0","unresolved":false,"context_lines":[{"line_number":105,"context_line":"            return constants.L3_DEFAULT_ROUTING_TABLE"},{"line_number":106,"context_line":"        return address_scope_id"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"    def get(self, address_scope_id):"},{"line_number":109,"context_line":"        \"\"\"Returns the table ID for the given scope\"\"\""},{"line_number":110,"context_line":"        table_name \u003d self._table_name(address_scope_id)"},{"line_number":111,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"ba3cc151_58be93d5","line":108,"updated":"2015-07-05 15:58:51.000000000","message":"I wonder why this method is necessary since, well, ip route allows you to use the table name precisely so you don\u0027t need to use the ID.","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"4f60b362e42108bacfb4ea4956f9b002c83109b0","unresolved":false,"context_lines":[{"line_number":131,"context_line":"                return RoutingTable(name_to_id[table_name], table_name)"},{"line_number":132,"context_line":""},{"line_number":133,"context_line":"            # Otherwise, find an available id and write the new file"},{"line_number":134,"context_line":"            table_ids \u003d set(name_to_id.values())"},{"line_number":135,"context_line":"            available_ids \u003d self.ALL_IDS - table_ids"},{"line_number":136,"context_line":"            name_to_id[table_name] \u003d table_id \u003d available_ids.pop()"},{"line_number":137,"context_line":"            self._write_map(name_to_id)"}],"source_content_type":"text/x-python","patch_set":5,"id":"ba3cc151_18afab95","line":134,"updated":"2015-07-05 15:58:51.000000000","message":"I\u0027d like for \"getting an available ID\" to become a function. Perhaps an inner function to the add method.","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"4f60b362e42108bacfb4ea4956f9b002c83109b0","unresolved":false,"context_lines":[{"line_number":149,"context_line":"            # Write the new file"},{"line_number":150,"context_line":"            self._write_map(name_to_id)"},{"line_number":151,"context_line":""},{"line_number":152,"context_line":"    def _write_map(self, name_to_id):"},{"line_number":153,"context_line":"        with open(self._rt_tables_filename, \"w\") as rt_file:"},{"line_number":154,"context_line":"            for name, table_id in name_to_id.items():"},{"line_number":155,"context_line":"                rt_file.write(\"%s\\t%s\\n\" % (table_id, name))"}],"source_content_type":"text/x-python","patch_set":5,"id":"ba3cc151_b871df79","line":152,"updated":"2015-07-05 15:58:51.000000000","message":"Please see neutron/agent/linux/utils.py.replace_file.","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"9e5a4ffc63b1b2eb2dbf344f3628a160d1d62538","unresolved":false,"context_lines":[{"line_number":149,"context_line":"            # Write the new file"},{"line_number":150,"context_line":"            self._write_map(name_to_id)"},{"line_number":151,"context_line":""},{"line_number":152,"context_line":"    def _write_map(self, name_to_id):"},{"line_number":153,"context_line":"        with open(self._rt_tables_filename, \"w\") as rt_file:"},{"line_number":154,"context_line":"            for name, table_id in name_to_id.items():"},{"line_number":155,"context_line":"                rt_file.write(\"%s\\t%s\\n\" % (table_id, name))"}],"source_content_type":"text/x-python","patch_set":5,"id":"9a8ffd7b_cf787e2e","line":152,"in_reply_to":"ba3cc151_b871df79","updated":"2015-11-30 23:04:10.000000000","message":"Done","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"4f60b362e42108bacfb4ea4956f9b002c83109b0","unresolved":false,"context_lines":[{"line_number":154,"context_line":"            for name, table_id in name_to_id.items():"},{"line_number":155,"context_line":"                rt_file.write(\"%s\\t%s\\n\" % (table_id, name))"},{"line_number":156,"context_line":""},{"line_number":157,"context_line":"    def _read_map(self):"},{"line_number":158,"context_line":"        with open(self._rt_tables_filename, \"r\") as rt_file:"},{"line_number":159,"context_line":"            for line in rt_file:"},{"line_number":160,"context_line":"                fields \u003d line.split()"}],"source_content_type":"text/x-python","patch_set":5,"id":"ba3cc151_38a06fa5","line":157,"updated":"2015-07-05 15:58:51.000000000","message":"Looks like this function is essentially being used in two different ways. One for iteration (L113) and one for getting the entire contents (All other usages). Perhaps the 2nd usage deserves a function of its own so that usages like L144 could be slightly simplified.","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"9e5a4ffc63b1b2eb2dbf344f3628a160d1d62538","unresolved":false,"context_lines":[{"line_number":154,"context_line":"            for name, table_id in name_to_id.items():"},{"line_number":155,"context_line":"                rt_file.write(\"%s\\t%s\\n\" % (table_id, name))"},{"line_number":156,"context_line":""},{"line_number":157,"context_line":"    def _read_map(self):"},{"line_number":158,"context_line":"        with open(self._rt_tables_filename, \"r\") as rt_file:"},{"line_number":159,"context_line":"            for line in rt_file:"},{"line_number":160,"context_line":"                fields \u003d line.split()"}],"source_content_type":"text/x-python","patch_set":5,"id":"9a8ffd7b_0f8766d8","line":157,"in_reply_to":"ba3cc151_38a06fa5","updated":"2015-11-30 23:04:10.000000000","message":"Done","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"4f60b362e42108bacfb4ea4956f9b002c83109b0","unresolved":false,"context_lines":[{"line_number":158,"context_line":"        with open(self._rt_tables_filename, \"r\") as rt_file:"},{"line_number":159,"context_line":"            for line in rt_file:"},{"line_number":160,"context_line":"                fields \u003d line.split()"},{"line_number":161,"context_line":"                if len(fields) !\u003d 2:"},{"line_number":162,"context_line":"                    continue"},{"line_number":163,"context_line":"                table_id_str, name \u003d fields"},{"line_number":164,"context_line":"                try:"}],"source_content_type":"text/x-python","patch_set":5,"id":"ba3cc151_f85527fa","line":161,"updated":"2015-07-05 15:58:51.000000000","message":"If this line fails, or you get a ValueError in line 166 you should LOG.error with the entire contents of the file. Failing to parse this file is not an expected error and we\u0027ll need the as much information as possible in case this does happen.","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"4562910b7fcfddd6cef09a6e20e46493952b03cf","unresolved":false,"context_lines":[{"line_number":148,"context_line":"        self.etc \u003d NamespaceEtcDir(namespace)"},{"line_number":149,"context_line":"        self._rt_tables_filename \u003d os.path.join("},{"line_number":150,"context_line":"            self.etc.get_full_path(), self.FILENAME)"},{"line_number":151,"context_line":"        linux_utils.ensure_dir(os.path.dirname(self._rt_tables_filename))"},{"line_number":152,"context_line":"        self._lockname \u003d \u0027rt_tables-%s\u0027 % namespace"},{"line_number":153,"context_line":"        self._tables \u003d {}"},{"line_number":154,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"7a2fa921_20505c31","line":151,"updated":"2015-10-10 00:45:22.000000000","message":"This comes from common utils now.","commit_id":"9d7c2c9b059e61b29ce277d1b5d4e63ccfa66b9a"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"54fb370bb7a65d3c9d6ad95a87101bd73b456a18","unresolved":false,"context_lines":[{"line_number":101,"context_line":"        ipv6_routes \u003d self.ip_lib.route.list_routes(constants.IP_VERSION_6)"},{"line_number":102,"context_line":"        self._all \u003d {(r[\u0027cidr\u0027], r[\u0027dev\u0027])"},{"line_number":103,"context_line":"                     for r in ipv4_routes + ipv6_routes}"},{"line_number":104,"context_line":"        self._keep \u003d set()"},{"line_number":105,"context_line":"        return self"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"    def __exit__(self, exc_type, value, traceback):"}],"source_content_type":"text/x-python","patch_set":17,"id":"7a2fa921_b43543f8","line":104,"updated":"2015-10-13 10:03:30.000000000","message":"if add or add_gateway are called before __enter__ is called, then they crash but if they are called after __exit__  they succeed","commit_id":"185f200b1c887044e26a5bd6019c88cef54e9abe"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"54fb370bb7a65d3c9d6ad95a87101bd73b456a18","unresolved":false,"context_lines":[{"line_number":149,"context_line":"        self._rt_tables_filename \u003d os.path.join("},{"line_number":150,"context_line":"            self.etc.get_full_path(), self.FILENAME)"},{"line_number":151,"context_line":"        utils.ensure_dir(os.path.dirname(self._rt_tables_filename))"},{"line_number":152,"context_line":"        self._lockname \u003d \u0027rt_tables-%s\u0027 % namespace"},{"line_number":153,"context_line":"        self._tables \u003d {}"},{"line_number":154,"context_line":""},{"line_number":155,"context_line":"        # Create a default table if one is not already found"}],"source_content_type":"text/x-python","patch_set":17,"id":"5a2ca52d_78cb5d73","line":152,"updated":"2015-10-13 10:03:30.000000000","message":"We use always the same lock, so we can define and use self._lock \u003d lockutils.lock(self._lockname)","commit_id":"185f200b1c887044e26a5bd6019c88cef54e9abe"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"475200b4ee3e536a08e54f3dba09114f6f11822a","unresolved":false,"context_lines":[{"line_number":149,"context_line":"        self._rt_tables_filename \u003d os.path.join("},{"line_number":150,"context_line":"            self.etc.get_full_path(), self.FILENAME)"},{"line_number":151,"context_line":"        utils.ensure_dir(os.path.dirname(self._rt_tables_filename))"},{"line_number":152,"context_line":"        self._lockname \u003d \u0027rt_tables-%s\u0027 % namespace"},{"line_number":153,"context_line":"        self._tables \u003d {}"},{"line_number":154,"context_line":""},{"line_number":155,"context_line":"        # Create a default table if one is not already found"}],"source_content_type":"text/x-python","patch_set":17,"id":"9a8ffd7b_abc3ad37","line":152,"in_reply_to":"5a2ca52d_78cb5d73","updated":"2015-12-01 00:56:59.000000000","message":"Done","commit_id":"185f200b1c887044e26a5bd6019c88cef54e9abe"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"54fb370bb7a65d3c9d6ad95a87101bd73b456a18","unresolved":false,"context_lines":[{"line_number":156,"context_line":"        with lockutils.lock(self._lockname):"},{"line_number":157,"context_line":"            if not os.path.exists(self._rt_tables_filename):"},{"line_number":158,"context_line":"                self._write_map(self.DEFAULT_TABLES)"},{"line_number":159,"context_line":"        self._keep \u003d set()"},{"line_number":160,"context_line":""},{"line_number":161,"context_line":"    def _table_name(self, name):"},{"line_number":162,"context_line":"        if name is None:"}],"source_content_type":"text/x-python","patch_set":17,"id":"5a2ca52d_bbf7aff4","line":159,"updated":"2015-10-13 10:03:30.000000000","message":"is it required?","commit_id":"185f200b1c887044e26a5bd6019c88cef54e9abe"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"475200b4ee3e536a08e54f3dba09114f6f11822a","unresolved":false,"context_lines":[{"line_number":156,"context_line":"        with lockutils.lock(self._lockname):"},{"line_number":157,"context_line":"            if not os.path.exists(self._rt_tables_filename):"},{"line_number":158,"context_line":"                self._write_map(self.DEFAULT_TABLES)"},{"line_number":159,"context_line":"        self._keep \u003d set()"},{"line_number":160,"context_line":""},{"line_number":161,"context_line":"    def _table_name(self, name):"},{"line_number":162,"context_line":"        if name is None:"}],"source_content_type":"text/x-python","patch_set":17,"id":"9a8ffd7b_cbc0712d","line":159,"in_reply_to":"5a2ca52d_bbf7aff4","updated":"2015-12-01 00:56:59.000000000","message":"Done","commit_id":"185f200b1c887044e26a5bd6019c88cef54e9abe"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"54fb370bb7a65d3c9d6ad95a87101bd73b456a18","unresolved":false,"context_lines":[{"line_number":211,"context_line":""},{"line_number":212,"context_line":"            # If it is already there, remove it"},{"line_number":213,"context_line":"            if table_name in name_to_id:"},{"line_number":214,"context_line":"                self._tables.pop(name_to_id[table_name], None)"},{"line_number":215,"context_line":"                del name_to_id[table_name]"},{"line_number":216,"context_line":""},{"line_number":217,"context_line":"            # Write the new file"}],"source_content_type":"text/x-python","patch_set":17,"id":"5a2ca52d_38c1652f","line":214,"updated":"2015-10-13 10:03:30.000000000","message":"use directly name_to_id.pop(table_name)","commit_id":"185f200b1c887044e26a5bd6019c88cef54e9abe"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"475200b4ee3e536a08e54f3dba09114f6f11822a","unresolved":false,"context_lines":[{"line_number":211,"context_line":""},{"line_number":212,"context_line":"            # If it is already there, remove it"},{"line_number":213,"context_line":"            if table_name in name_to_id:"},{"line_number":214,"context_line":"                self._tables.pop(name_to_id[table_name], None)"},{"line_number":215,"context_line":"                del name_to_id[table_name]"},{"line_number":216,"context_line":""},{"line_number":217,"context_line":"            # Write the new file"}],"source_content_type":"text/x-python","patch_set":17,"id":"9a8ffd7b_6b7865f9","line":214,"in_reply_to":"5a2ca52d_38c1652f","updated":"2015-12-01 00:56:59.000000000","message":"Done","commit_id":"185f200b1c887044e26a5bd6019c88cef54e9abe"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"54fb370bb7a65d3c9d6ad95a87101bd73b456a18","unresolved":false,"context_lines":[{"line_number":243,"context_line":"                        if rt.table_id not in self.DEFAULT_TABLES.values())"},{"line_number":244,"context_line":"        self._keep \u003d set()"},{"line_number":245,"context_line":"        for rt in self._all:"},{"line_number":246,"context_line":"            rt.__enter__()"},{"line_number":247,"context_line":"        return self"},{"line_number":248,"context_line":""},{"line_number":249,"context_line":"    def __exit__(self, exc_type, value, traceback):"}],"source_content_type":"text/x-python","patch_set":17,"id":"5a2ca52d_5520ac49","line":246,"updated":"2015-10-13 10:03:30.000000000","message":"No rt__exit__ is called if any rt.__enter__ fails which means we are assuming how RoutingTable.__enter__/_exit__ internally behaves which imo is a wrong design","commit_id":"185f200b1c887044e26a5bd6019c88cef54e9abe"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"54fb370bb7a65d3c9d6ad95a87101bd73b456a18","unresolved":false,"context_lines":[{"line_number":246,"context_line":"            rt.__enter__()"},{"line_number":247,"context_line":"        return self"},{"line_number":248,"context_line":""},{"line_number":249,"context_line":"    def __exit__(self, exc_type, value, traceback):"},{"line_number":250,"context_line":"        if exc_type:"},{"line_number":251,"context_line":"            return False"},{"line_number":252,"context_line":""}],"source_content_type":"text/x-python","patch_set":17,"id":"7a2fa921_9e962593","line":249,"updated":"2015-10-13 10:03:30.000000000","message":"This method assumes we don\u0027t need to call RoutingTable._exit__ when an error is raised in RoutingTableManager context (see previous comment)","commit_id":"185f200b1c887044e26a5bd6019c88cef54e9abe"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"54fb370bb7a65d3c9d6ad95a87101bd73b456a18","unresolved":false,"context_lines":[{"line_number":250,"context_line":"        if exc_type:"},{"line_number":251,"context_line":"            return False"},{"line_number":252,"context_line":""},{"line_number":253,"context_line":"        for rt in self._all:"},{"line_number":254,"context_line":"            rt.__exit__(None, None, None)"},{"line_number":255,"context_line":""},{"line_number":256,"context_line":"        for rt in self._all - self._keep:"}],"source_content_type":"text/x-python","patch_set":17,"id":"5a2ca52d_f578d891","line":253,"updated":"2015-10-13 10:03:30.000000000","message":"We are assuming that RoutingTable.__exit__ will never fail or that it\u0027s fine not to call all RoutingTable.__exit__ if one fails  (see previous comment)","commit_id":"185f200b1c887044e26a5bd6019c88cef54e9abe"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"f679e0baa4210ef771e7d48068a7e5fcd961bdb9","unresolved":false,"context_lines":[{"line_number":1,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"},{"line_number":2,"context_line":"#    not use this file except in compliance with the License. You may obtain"},{"line_number":3,"context_line":"#    a copy of the License at"},{"line_number":4,"context_line":"#"}],"source_content_type":"text/x-python","patch_set":22,"id":"ba8a016a_36c1dc54","line":1,"updated":"2015-11-18 22:08:43.000000000","message":"I thought you guys at the company formerly known as HP were required to put copyright attribution!","commit_id":"8bf93d7b7e7937dd74d3cce07a0e300aa2096d1c"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"082d078cd5f6e92ff0b9108dfbed152fbff25f20","unresolved":false,"context_lines":[{"line_number":1,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"},{"line_number":2,"context_line":"#    not use this file except in compliance with the License. You may obtain"},{"line_number":3,"context_line":"#    a copy of the License at"},{"line_number":4,"context_line":"#"}],"source_content_type":"text/x-python","patch_set":22,"id":"9a8ffd7b_747362b5","line":1,"in_reply_to":"ba8a016a_36c1dc54","updated":"2015-12-01 19:01:29.000000000","message":"Done","commit_id":"8bf93d7b7e7937dd74d3cce07a0e300aa2096d1c"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"f679e0baa4210ef771e7d48068a7e5fcd961bdb9","unresolved":false,"context_lines":[{"line_number":34,"context_line":"    purpose, it should probably be owned by the namespace so that the namespace"},{"line_number":35,"context_line":"    can create/destroy it along with the namespace."},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"    TODO(Carl) move this to the namespace"},{"line_number":38,"context_line":"    \"\"\""},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    BASE_DIR \u003d \"/etc/netns\""}],"source_content_type":"text/x-python","patch_set":22,"id":"ba8a016a_569d8064","line":37,"updated":"2015-11-18 22:08:43.000000000","message":"I\u0027m not sure what this todo means? do we have a module specific for namespaces?","commit_id":"8bf93d7b7e7937dd74d3cce07a0e300aa2096d1c"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"082d078cd5f6e92ff0b9108dfbed152fbff25f20","unresolved":false,"context_lines":[{"line_number":34,"context_line":"    purpose, it should probably be owned by the namespace so that the namespace"},{"line_number":35,"context_line":"    can create/destroy it along with the namespace."},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"    TODO(Carl) move this to the namespace"},{"line_number":38,"context_line":"    \"\"\""},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    BASE_DIR \u003d \"/etc/netns\""}],"source_content_type":"text/x-python","patch_set":22,"id":"9a8ffd7b_2e2f9589","line":37,"in_reply_to":"ba8a016a_569d8064","updated":"2015-12-01 19:01:29.000000000","message":"Yes, we do in the L3 agent at least.","commit_id":"8bf93d7b7e7937dd74d3cce07a0e300aa2096d1c"},{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"3ec3d58928de92e7fce883f880a9439ae13bd5a7","unresolved":false,"context_lines":[{"line_number":55,"context_line":"        self._directory \u003d directory"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"    def destroy(self):"},{"line_number":58,"context_line":"        linux_utils.execute([\"rmdir\", self._directory],"},{"line_number":59,"context_line":"                            run_as_root\u003dself.as_root)"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"    def get_full_path(self):"}],"source_content_type":"text/x-python","patch_set":22,"id":"ba8a016a_740780ca","line":58,"updated":"2015-11-18 11:29:45.000000000","message":"I can only imagine to use rm -rf here.","commit_id":"8bf93d7b7e7937dd74d3cce07a0e300aa2096d1c"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"082d078cd5f6e92ff0b9108dfbed152fbff25f20","unresolved":false,"context_lines":[{"line_number":55,"context_line":"        self._directory \u003d directory"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"    def destroy(self):"},{"line_number":58,"context_line":"        linux_utils.execute([\"rmdir\", self._directory],"},{"line_number":59,"context_line":"                            run_as_root\u003dself.as_root)"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"    def get_full_path(self):"}],"source_content_type":"text/x-python","patch_set":22,"id":"9a8ffd7b_74fe0207","line":58,"in_reply_to":"ba8a016a_3638fcee","updated":"2015-12-01 19:01:29.000000000","message":"Done","commit_id":"8bf93d7b7e7937dd74d3cce07a0e300aa2096d1c"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"f679e0baa4210ef771e7d48068a7e5fcd961bdb9","unresolved":false,"context_lines":[{"line_number":55,"context_line":"        self._directory \u003d directory"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"    def destroy(self):"},{"line_number":58,"context_line":"        linux_utils.execute([\"rmdir\", self._directory],"},{"line_number":59,"context_line":"                            run_as_root\u003dself.as_root)"},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"    def get_full_path(self):"}],"source_content_type":"text/x-python","patch_set":22,"id":"ba8a016a_3638fcee","line":58,"in_reply_to":"ba8a016a_740780ca","updated":"2015-11-18 22:08:43.000000000","message":"I tend to agree with this comment.","commit_id":"8bf93d7b7e7937dd74d3cce07a0e300aa2096d1c"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"f679e0baa4210ef771e7d48068a7e5fcd961bdb9","unresolved":false,"context_lines":[{"line_number":67,"context_line":"        self._namespace \u003d namespace"},{"line_number":68,"context_line":"        self._name \u003d name"},{"line_number":69,"context_line":"        self.table_id \u003d table_id"},{"line_number":70,"context_line":"        self.ip_lib \u003d ip_lib.IPRoute(namespace\u003dnamespace, table\u003dname)"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"    def __eq__(self, other):"},{"line_number":73,"context_line":"        return self.table_id \u003d\u003d other.table_id"}],"source_content_type":"text/x-python","patch_set":22,"id":"ba8a016a_960e8839","line":70,"updated":"2015-11-18 22:08:43.000000000","message":"nit: the object you\u0027re creating here is an instance of IPRoute. Are you sure you want to call the class attribute ip_lib?","commit_id":"8bf93d7b7e7937dd74d3cce07a0e300aa2096d1c"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"082d078cd5f6e92ff0b9108dfbed152fbff25f20","unresolved":false,"context_lines":[{"line_number":67,"context_line":"        self._namespace \u003d namespace"},{"line_number":68,"context_line":"        self._name \u003d name"},{"line_number":69,"context_line":"        self.table_id \u003d table_id"},{"line_number":70,"context_line":"        self.ip_lib \u003d ip_lib.IPRoute(namespace\u003dnamespace, table\u003dname)"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"    def __eq__(self, other):"},{"line_number":73,"context_line":"        return self.table_id \u003d\u003d other.table_id"}],"source_content_type":"text/x-python","patch_set":22,"id":"9a8ffd7b_d419ee7a","line":70,"in_reply_to":"ba8a016a_960e8839","updated":"2015-12-01 19:01:29.000000000","message":"Done","commit_id":"8bf93d7b7e7937dd74d3cce07a0e300aa2096d1c"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"f679e0baa4210ef771e7d48068a7e5fcd961bdb9","unresolved":false,"context_lines":[{"line_number":87,"context_line":"        cidr \u003d netaddr.IPNetwork(cidr)"},{"line_number":88,"context_line":"        # Get the network cidr (e.g. 192.168.5.135/23 -\u003e 192.168.4.0/23)"},{"line_number":89,"context_line":"        net \u003d utils.ip_to_cidr(cidr.network, cidr.prefixlen)"},{"line_number":90,"context_line":"        self._keep.add((net, device.name))"},{"line_number":91,"context_line":"        table.add_onlink_route(net)"},{"line_number":92,"context_line":""},{"line_number":93,"context_line":"    def add_gateway(self, device, gateway_ip):"}],"source_content_type":"text/x-python","patch_set":22,"id":"ba8a016a_1184e25b","line":90,"updated":"2015-11-18 22:08:43.000000000","message":"add and add_gateway only work if used within a with block, because otherwise _keep would be undefined. Is this your intention?","commit_id":"8bf93d7b7e7937dd74d3cce07a0e300aa2096d1c"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"5d28774f02b9d80c3e63fd0b35a0fdcecc8c884e","unresolved":false,"context_lines":[{"line_number":87,"context_line":"        cidr \u003d netaddr.IPNetwork(cidr)"},{"line_number":88,"context_line":"        # Get the network cidr (e.g. 192.168.5.135/23 -\u003e 192.168.4.0/23)"},{"line_number":89,"context_line":"        net \u003d utils.ip_to_cidr(cidr.network, cidr.prefixlen)"},{"line_number":90,"context_line":"        self._keep.add((net, device.name))"},{"line_number":91,"context_line":"        table.add_onlink_route(net)"},{"line_number":92,"context_line":""},{"line_number":93,"context_line":"    def add_gateway(self, device, gateway_ip):"}],"source_content_type":"text/x-python","patch_set":22,"id":"9a8ffd7b_8e0b217d","line":90,"in_reply_to":"ba8a016a_1184e25b","updated":"2015-12-01 20:52:45.000000000","message":"The next iteration will be friendlier in this way and initialize self._keep in __init__.","commit_id":"8bf93d7b7e7937dd74d3cce07a0e300aa2096d1c"},{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"3ec3d58928de92e7fce883f880a9439ae13bd5a7","unresolved":false,"context_lines":[{"line_number":111,"context_line":"        for cidr, dev in self._all - self._keep:"},{"line_number":112,"context_line":"            try:"},{"line_number":113,"context_line":"                self.ip_lib.route.delete_route(cidr, dev\u003ddev)"},{"line_number":114,"context_line":"            except exceptions.DeviceNotFoundError:"},{"line_number":115,"context_line":"                pass"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"        return True"}],"source_content_type":"text/x-python","patch_set":22,"id":"ba8a016a_348018f7","line":114,"updated":"2015-11-18 11:29:45.000000000","message":"Although the DeviceNotFoundError will be ignore here, l3-agent will still report such exception from [1]. Maybe a check here before delete_route can eliminate the error.\n\nERROR neutron.agent.linux.utils [-] Command: [\u0027ip\u0027, \u0027netns\u0027, \u0027exec\u0027, u\u0027qrouter-e7f51ebb-b754-423c-aa31-6a8a859c148e\u0027, \u0027ip\u0027, \u0027-4\u0027, \u0027route\u0027, \u0027del\u0027, u\u0027100.0.0.0/24\u0027, \u0027table\u0027, \u0027noscope\u0027, \u0027dev\u0027, u\u0027qr-5c890fb5-ab\u0027]; Exit code: 1; Stdin: ; Stdout: ; Stderr: Cannot find device \"qr-5c890fb5-ab\"\n\n[1] https://github.com/openstack/neutron/blob/master/neutron/agent/linux/utils.py#L147","commit_id":"8bf93d7b7e7937dd74d3cce07a0e300aa2096d1c"},{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"fc885987e4f23bdf909891f85713c05b6a027ece","unresolved":false,"context_lines":[{"line_number":111,"context_line":"        for cidr, dev in self._all - self._keep:"},{"line_number":112,"context_line":"            try:"},{"line_number":113,"context_line":"                self.ip_lib.route.delete_route(cidr, dev\u003ddev)"},{"line_number":114,"context_line":"            except exceptions.DeviceNotFoundError:"},{"line_number":115,"context_line":"                pass"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"        return True"}],"source_content_type":"text/x-python","patch_set":22,"id":"7a740942_caaef297","line":114,"in_reply_to":"7a740942_5e688c87","updated":"2015-12-05 16:09:54.000000000","message":"Actually, I haven\u0027t seen the error log with the latest code.","commit_id":"8bf93d7b7e7937dd74d3cce07a0e300aa2096d1c"},{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"e695f619a982acf18d5b0e528aec750deeb968e1","unresolved":false,"context_lines":[{"line_number":111,"context_line":"        for cidr, dev in self._all - self._keep:"},{"line_number":112,"context_line":"            try:"},{"line_number":113,"context_line":"                self.ip_lib.route.delete_route(cidr, dev\u003ddev)"},{"line_number":114,"context_line":"            except exceptions.DeviceNotFoundError:"},{"line_number":115,"context_line":"                pass"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"        return True"}],"source_content_type":"text/x-python","patch_set":22,"id":"7a740942_5e688c87","line":114,"in_reply_to":"9a8ffd7b_cec60916","updated":"2015-12-05 04:39:57.000000000","message":"I go through the code, and I think your suggestion is better. \nIt looks more like a common bug for [1].\nI would investigate more on it and file a bug if necessary. \n\n[1]neutron.agent.linux.ip_lib._run_as_root_detect_device_not_found","commit_id":"8bf93d7b7e7937dd74d3cce07a0e300aa2096d1c"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"082d078cd5f6e92ff0b9108dfbed152fbff25f20","unresolved":false,"context_lines":[{"line_number":111,"context_line":"        for cidr, dev in self._all - self._keep:"},{"line_number":112,"context_line":"            try:"},{"line_number":113,"context_line":"                self.ip_lib.route.delete_route(cidr, dev\u003ddev)"},{"line_number":114,"context_line":"            except exceptions.DeviceNotFoundError:"},{"line_number":115,"context_line":"                pass"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"        return True"}],"source_content_type":"text/x-python","patch_set":22,"id":"9a8ffd7b_cec60916","line":114,"in_reply_to":"ba8a016a_348018f7","updated":"2015-12-01 19:01:29.000000000","message":"Hong, your link doesn\u0027t seem to work  because it references master and master has moved.  Let me see if I can read it by replacing master with the commit id of this commit\u0027s parent.  Hopefully that will get me close.  Yeah, this looks better [1].\n\nI\u0027d rather not check first.  I\u0027d rather get rid of the log somehow.  I think that should be done separately from this patch.\n\n [1] https://github.com/openstack/neutron/blob/1c9681bc77ef12453fa6fb239635a999732c240a/neutron/agent/linux/utils.py#L147\n\nA hint: you can get a perma-link from github by hitting the \u0027y\u0027 key on the github page.","commit_id":"8bf93d7b7e7937dd74d3cce07a0e300aa2096d1c"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"f679e0baa4210ef771e7d48068a7e5fcd961bdb9","unresolved":false,"context_lines":[{"line_number":148,"context_line":"        self.etc \u003d NamespaceEtcDir(namespace)"},{"line_number":149,"context_line":"        self._rt_tables_filename \u003d os.path.join("},{"line_number":150,"context_line":"            self.etc.get_full_path(), self.FILENAME)"},{"line_number":151,"context_line":"        utils.ensure_dir(os.path.dirname(self._rt_tables_filename))"},{"line_number":152,"context_line":"        self._lockname \u003d \u0027rt_tables-%s\u0027 % namespace"},{"line_number":153,"context_line":"        self._tables \u003d {}"},{"line_number":154,"context_line":""}],"source_content_type":"text/x-python","patch_set":22,"id":"ba8a016a_313326ad","line":151,"updated":"2015-11-18 22:08:43.000000000","message":"I think ensure_dir is redundant. What do you reckon?","commit_id":"8bf93d7b7e7937dd74d3cce07a0e300aa2096d1c"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"082d078cd5f6e92ff0b9108dfbed152fbff25f20","unresolved":false,"context_lines":[{"line_number":148,"context_line":"        self.etc \u003d NamespaceEtcDir(namespace)"},{"line_number":149,"context_line":"        self._rt_tables_filename \u003d os.path.join("},{"line_number":150,"context_line":"            self.etc.get_full_path(), self.FILENAME)"},{"line_number":151,"context_line":"        utils.ensure_dir(os.path.dirname(self._rt_tables_filename))"},{"line_number":152,"context_line":"        self._lockname \u003d \u0027rt_tables-%s\u0027 % namespace"},{"line_number":153,"context_line":"        self._tables \u003d {}"},{"line_number":154,"context_line":""}],"source_content_type":"text/x-python","patch_set":22,"id":"9a8ffd7b_b44a2a54","line":151,"in_reply_to":"ba8a016a_313326ad","updated":"2015-12-01 19:01:29.000000000","message":"No, it isn\u0027t.  FILENAME has another directory component that might not exist.","commit_id":"8bf93d7b7e7937dd74d3cce07a0e300aa2096d1c"},{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"a34d7d17262a9b6e45f771b723bcf9e6036ac2f9","unresolved":false,"context_lines":[{"line_number":201,"context_line":"            available_ids \u003d self.ALL_IDS - table_ids"},{"line_number":202,"context_line":"            name_to_id[table_name] \u003d table_id \u003d available_ids.pop()"},{"line_number":203,"context_line":"            self._write_map(name_to_id)"},{"line_number":204,"context_line":"            return self._get_or_create(table_id, table_name)"},{"line_number":205,"context_line":""},{"line_number":206,"context_line":"    def delete(self, name):"},{"line_number":207,"context_line":"        \"\"\"Removes the address scope from the file\"\"\""}],"source_content_type":"text/x-python","patch_set":22,"id":"ba8a016a_40198c78","line":204,"updated":"2015-11-17 15:10:46.000000000","message":"This gonna to create new RoutingTable here. But the table here don\u0027t get initialized. So, for the new RoutingTable, there will be \n\nAttributeError: \u0027RoutingTable\u0027 object has no attribute \u0027_keep\u0027.\n\nThe table here should be initialized before returning.","commit_id":"8bf93d7b7e7937dd74d3cce07a0e300aa2096d1c"},{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"e695f619a982acf18d5b0e528aec750deeb968e1","unresolved":false,"context_lines":[{"line_number":201,"context_line":"            available_ids \u003d self.ALL_IDS - table_ids"},{"line_number":202,"context_line":"            name_to_id[table_name] \u003d table_id \u003d available_ids.pop()"},{"line_number":203,"context_line":"            self._write_map(name_to_id)"},{"line_number":204,"context_line":"            return self._get_or_create(table_id, table_name)"},{"line_number":205,"context_line":""},{"line_number":206,"context_line":"    def delete(self, name):"},{"line_number":207,"context_line":"        \"\"\"Removes the address scope from the file\"\"\""}],"source_content_type":"text/x-python","patch_set":22,"id":"7a740942_3ee82010","line":204,"in_reply_to":"9a8ffd7b_e20be122","updated":"2015-12-05 04:39:57.000000000","message":"Yes, that is what I meant. I don\u0027t see the issue in the latest patch, thanks.","commit_id":"8bf93d7b7e7937dd74d3cce07a0e300aa2096d1c"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"5d28774f02b9d80c3e63fd0b35a0fdcecc8c884e","unresolved":false,"context_lines":[{"line_number":201,"context_line":"            available_ids \u003d self.ALL_IDS - table_ids"},{"line_number":202,"context_line":"            name_to_id[table_name] \u003d table_id \u003d available_ids.pop()"},{"line_number":203,"context_line":"            self._write_map(name_to_id)"},{"line_number":204,"context_line":"            return self._get_or_create(table_id, table_name)"},{"line_number":205,"context_line":""},{"line_number":206,"context_line":"    def delete(self, name):"},{"line_number":207,"context_line":"        \"\"\"Removes the address scope from the file\"\"\""}],"source_content_type":"text/x-python","patch_set":22,"id":"9a8ffd7b_e20be122","line":204,"in_reply_to":"ba8a016a_40198c78","updated":"2015-12-01 20:52:45.000000000","message":"Do you mean that __enter__ is not called on it?  I didn\u0027t see that in my testing but maybe my testing was not complete.  Actually, I see how this is a problem.  Nice catch!  I fixed this by moving pretty much everything out of the __enter__ method and in to the __exit__ method and making sure to initialize self._keep in __init__.","commit_id":"8bf93d7b7e7937dd74d3cce07a0e300aa2096d1c"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"855b09bbb2a94084b566a6e08ae12055f3c73b3f","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# Copyright (c) 2015 Hewlett-Packard Enterprise Development Company, L.P."},{"line_number":2,"context_line":"#"},{"line_number":3,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"},{"line_number":4,"context_line":"#    not use this file except in compliance with the License. You may obtain"}],"source_content_type":"text/x-python","patch_set":26,"id":"9a8ffd7b_36753963","line":1,"updated":"2015-12-03 12:06:35.000000000","message":"ah here it is!","commit_id":"92b97fdc53cd6cfc997294d6bd4b42d0bf7b4ca0"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"95e6f113ad34664ca49a5f13d4bf20904667dbc2","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# Copyright (c) 2015 Hewlett-Packard Enterprise Development Company, L.P."},{"line_number":2,"context_line":"#"},{"line_number":3,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"},{"line_number":4,"context_line":"#    not use this file except in compliance with the License. You may obtain"}],"source_content_type":"text/x-python","patch_set":26,"id":"7a740942_3d739b4f","line":1,"in_reply_to":"9a8ffd7b_36753963","updated":"2015-12-03 16:32:15.000000000","message":"Technically there\u0027s no \"-\" in the name, just being pedantic...","commit_id":"92b97fdc53cd6cfc997294d6bd4b42d0bf7b4ca0"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"95e6f113ad34664ca49a5f13d4bf20904667dbc2","unresolved":false,"context_lines":[{"line_number":38,"context_line":"    TODO(Carl) move this to the namespace"},{"line_number":39,"context_line":"    \"\"\""},{"line_number":40,"context_line":""},{"line_number":41,"context_line":"    BASE_DIR \u003d \"/etc/netns\""},{"line_number":42,"context_line":""},{"line_number":43,"context_line":"    def __init__(self, namespace):"},{"line_number":44,"context_line":"        self._directory \u003d os.path.join(self.BASE_DIR, namespace)"}],"source_content_type":"text/x-python","patch_set":26,"id":"7a740942_e8b9cfed","line":41,"updated":"2015-12-03 16:32:15.000000000","message":"Seeing this, your comment on L33, and L132 makes me think some of this belongs in the /linux/ directory since it\u0027s pretty OS-specific.  I know there\u0027s some code to detect Windows so wonder if this will break that?  Of course there\u0027s other places that use /etc and seem to be Ok.","commit_id":"92b97fdc53cd6cfc997294d6bd4b42d0bf7b4ca0"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"95e6f113ad34664ca49a5f13d4bf20904667dbc2","unresolved":false,"context_lines":[{"line_number":44,"context_line":"        self._directory \u003d os.path.join(self.BASE_DIR, namespace)"},{"line_number":45,"context_line":""},{"line_number":46,"context_line":"    def create(self):"},{"line_number":47,"context_line":"        linux_utils.execute([\"mkdir\", \"-p\", self._directory],"},{"line_number":48,"context_line":"                            run_as_root\u003dTrue)"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":"        user_id \u003d os.geteuid()"}],"source_content_type":"text/x-python","patch_set":26,"id":"7a740942_e8622f16","line":47,"updated":"2015-12-03 16:32:15.000000000","message":"utils.ensure_dir(self._directory)","commit_id":"92b97fdc53cd6cfc997294d6bd4b42d0bf7b4ca0"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"904698ba153ef42dbb5a6a8c9868f6ca3fa8ff09","unresolved":false,"context_lines":[{"line_number":44,"context_line":"        self._directory \u003d os.path.join(self.BASE_DIR, namespace)"},{"line_number":45,"context_line":""},{"line_number":46,"context_line":"    def create(self):"},{"line_number":47,"context_line":"        linux_utils.execute([\"mkdir\", \"-p\", self._directory],"},{"line_number":48,"context_line":"                            run_as_root\u003dTrue)"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":"        user_id \u003d os.geteuid()"}],"source_content_type":"text/x-python","patch_set":26,"id":"7a740942_05b0b6f3","line":47,"in_reply_to":"7a740942_e8622f16","updated":"2015-12-03 21:21:02.000000000","message":"need root which means I have to go through rootwrap with a command.  I can\u0027t call a python call (yet).  Hopefully angus will have that fixed for me soon.","commit_id":"92b97fdc53cd6cfc997294d6bd4b42d0bf7b4ca0"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"95e6f113ad34664ca49a5f13d4bf20904667dbc2","unresolved":false,"context_lines":[{"line_number":49,"context_line":""},{"line_number":50,"context_line":"        user_id \u003d os.geteuid()"},{"line_number":51,"context_line":"        linux_utils.execute([\"chown\", user_id, self._directory],"},{"line_number":52,"context_line":"                            run_as_root\u003dTrue)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"    def destroy(self):"},{"line_number":55,"context_line":"        linux_utils.execute([\"rm\", \"-rf\", self._directory],"}],"source_content_type":"text/x-python","patch_set":26,"id":"7a740942_83da6c77","line":52,"updated":"2015-12-03 16:32:15.000000000","message":"Is this necessary?  If so can use os.chown()","commit_id":"92b97fdc53cd6cfc997294d6bd4b42d0bf7b4ca0"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"904698ba153ef42dbb5a6a8c9868f6ca3fa8ff09","unresolved":false,"context_lines":[{"line_number":49,"context_line":""},{"line_number":50,"context_line":"        user_id \u003d os.geteuid()"},{"line_number":51,"context_line":"        linux_utils.execute([\"chown\", user_id, self._directory],"},{"line_number":52,"context_line":"                            run_as_root\u003dTrue)"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"    def destroy(self):"},{"line_number":55,"context_line":"        linux_utils.execute([\"rm\", \"-rf\", self._directory],"}],"source_content_type":"text/x-python","patch_set":26,"id":"7a740942_c592ae57","line":52,"in_reply_to":"7a740942_83da6c77","updated":"2015-12-03 21:21:02.000000000","message":"root","commit_id":"92b97fdc53cd6cfc997294d6bd4b42d0bf7b4ca0"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"95e6f113ad34664ca49a5f13d4bf20904667dbc2","unresolved":false,"context_lines":[{"line_number":53,"context_line":""},{"line_number":54,"context_line":"    def destroy(self):"},{"line_number":55,"context_line":"        linux_utils.execute([\"rm\", \"-rf\", self._directory],"},{"line_number":56,"context_line":"                            run_as_root\u003dTrue)"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":"    def get_full_path(self):"},{"line_number":59,"context_line":"        return self._directory"}],"source_content_type":"text/x-python","patch_set":26,"id":"7a740942_e35d70ed","line":56,"updated":"2015-12-03 16:32:15.000000000","message":"os.removedirs()","commit_id":"92b97fdc53cd6cfc997294d6bd4b42d0bf7b4ca0"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"904698ba153ef42dbb5a6a8c9868f6ca3fa8ff09","unresolved":false,"context_lines":[{"line_number":53,"context_line":""},{"line_number":54,"context_line":"    def destroy(self):"},{"line_number":55,"context_line":"        linux_utils.execute([\"rm\", \"-rf\", self._directory],"},{"line_number":56,"context_line":"                            run_as_root\u003dTrue)"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":"    def get_full_path(self):"},{"line_number":59,"context_line":"        return self._directory"}],"source_content_type":"text/x-python","patch_set":26,"id":"7a740942_659f3a60","line":56,"in_reply_to":"7a740942_e35d70ed","updated":"2015-12-03 21:21:02.000000000","message":"root","commit_id":"92b97fdc53cd6cfc997294d6bd4b42d0bf7b4ca0"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"23d0e84ea89b819386be7a53b0575efca536cde2","unresolved":false,"context_lines":[{"line_number":157,"context_line":"        if not table:"},{"line_number":158,"context_line":"            self._tables[table_id] \u003d table \u003d RoutingTable("},{"line_number":159,"context_line":"                 self._namespace, table_id, table_name)"},{"line_number":160,"context_line":"        self._keep.add(table)"},{"line_number":161,"context_line":"        return table"},{"line_number":162,"context_line":""},{"line_number":163,"context_line":"    def get(self, table_name):"}],"source_content_type":"text/x-python","patch_set":36,"id":"1a7b0d38_97137a5c","line":160,"range":{"start_line":160,"start_character":13,"end_line":160,"end_character":22},"updated":"2015-12-23 00:22:14.000000000","message":"Had a discussion with xiaohhui over IRC.  We thought that maybe this call should not be here.  It doesn\u0027t make sense because just looking at the table shouldn\u0027t cause it to stick around.  I wonder if it should be moved to the add method.","commit_id":"6b89be090f294465f3b028a70d6519ad292382d8"}],"neutron/tests/unit/agent/l3/test_rt_tables.py":[{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"4f60b362e42108bacfb4ea4956f9b002c83109b0","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# Copyright 2014 Hewlett-Packard Development Company, L.P."},{"line_number":2,"context_line":"#"},{"line_number":3,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"},{"line_number":4,"context_line":"#    not use this file except in compliance with the License. You may obtain"}],"source_content_type":"text/x-python","patch_set":5,"id":"ba3cc151_d8914354","line":1,"updated":"2015-07-05 15:58:51.000000000","message":"2015.","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"4892202178c328ea7fb233e45b57158d617b7cb1","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# Copyright 2014 Hewlett-Packard Development Company, L.P."},{"line_number":2,"context_line":"#"},{"line_number":3,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"},{"line_number":4,"context_line":"#    not use this file except in compliance with the License. You may obtain"}],"source_content_type":"text/x-python","patch_set":5,"id":"ba3cc151_2179ecfc","line":1,"in_reply_to":"ba3cc151_d8914354","updated":"2015-07-06 22:38:26.000000000","message":"Unintentional carry-over from a copy-paste of the license.  I\u0027m going to remove it.","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"4f60b362e42108bacfb4ea4956f9b002c83109b0","unresolved":false,"context_lines":[{"line_number":21,"context_line":"from neutron.tests import base"},{"line_number":22,"context_line":""},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"def mock_netnamespace_directory(function):"},{"line_number":25,"context_line":"    \"\"\"Decorator to test RoutingTablesManager without root privs"},{"line_number":26,"context_line":""},{"line_number":27,"context_line":"    Allows direct testing of RoutingTablesManager by changing the directory"}],"source_content_type":"text/x-python","patch_set":5,"id":"ba3cc151_9872db48","line":24,"updated":"2015-07-05 15:58:51.000000000","message":"This is very clever, kudos :)\n\nI do wonder if we should do this, or remove the mock, move this test to the functional subdir and be done with it. Are you foreseeing any issues with having this a functional test instead? (I\u0027m not). The only modification would be for setUp to create a Namespace fixture, get its generated name and pass it to RoutingTablesManager, that\u0027s pretty much it.","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"a0a5bfe89ce5d24c9b5efdbf87860528db75453e","unresolved":false,"context_lines":[{"line_number":21,"context_line":"from neutron.tests import base"},{"line_number":22,"context_line":""},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"def mock_netnamespace_directory(function):"},{"line_number":25,"context_line":"    \"\"\"Decorator to test RoutingTablesManager without root privs"},{"line_number":26,"context_line":""},{"line_number":27,"context_line":"    Allows direct testing of RoutingTablesManager by changing the directory"}],"source_content_type":"text/x-python","patch_set":5,"id":"ba3cc151_fb076116","line":24,"in_reply_to":"ba3cc151_9872db48","updated":"2015-07-05 17:26:37.000000000","message":"Also if we move this to tests/functional we can add a slightly higher level test that adds a name/id pair then uses \u0027ip route get table_name\u0027 and asserts that the command returned without error.","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"4892202178c328ea7fb233e45b57158d617b7cb1","unresolved":false,"context_lines":[{"line_number":21,"context_line":"from neutron.tests import base"},{"line_number":22,"context_line":""},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"def mock_netnamespace_directory(function):"},{"line_number":25,"context_line":"    \"\"\"Decorator to test RoutingTablesManager without root privs"},{"line_number":26,"context_line":""},{"line_number":27,"context_line":"    Allows direct testing of RoutingTablesManager by changing the directory"}],"source_content_type":"text/x-python","patch_set":5,"id":"ba3cc151_21600c35","line":24,"in_reply_to":"ba3cc151_fb076116","updated":"2015-07-06 22:38:26.000000000","message":"DRAFT:  Honestly, I think it is a big pain to have to test on a system with root privs.","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"4f60b362e42108bacfb4ea4956f9b002c83109b0","unresolved":false,"context_lines":[{"line_number":57,"context_line":"    def setUp(self):"},{"line_number":58,"context_line":"        super(TestRoutingTablesManager, self).setUp()"},{"line_number":59,"context_line":"        self.ns_name \u003d \"fakens\""},{"line_number":60,"context_line":"        self.scope_id \u003d \"fakescope\""},{"line_number":61,"context_line":""},{"line_number":62,"context_line":"    @mock_netnamespace_directory"},{"line_number":63,"context_line":"    def test_default_tables(self):"}],"source_content_type":"text/x-python","patch_set":5,"id":"ba3cc151_b87b1f29","line":60,"updated":"2015-07-05 15:58:51.000000000","message":"scope_id should not be an instance variable, it should be a local variable in the tests that use it. (I generally avoid class instance variables, it\u0027s *much* easier reading a test if everything the test needs is declared in the test itself). ns_name makes more sense.","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"4892202178c328ea7fb233e45b57158d617b7cb1","unresolved":false,"context_lines":[{"line_number":57,"context_line":"    def setUp(self):"},{"line_number":58,"context_line":"        super(TestRoutingTablesManager, self).setUp()"},{"line_number":59,"context_line":"        self.ns_name \u003d \"fakens\""},{"line_number":60,"context_line":"        self.scope_id \u003d \"fakescope\""},{"line_number":61,"context_line":""},{"line_number":62,"context_line":"    @mock_netnamespace_directory"},{"line_number":63,"context_line":"    def test_default_tables(self):"}],"source_content_type":"text/x-python","patch_set":5,"id":"ba3cc151_81e0f897","line":60,"in_reply_to":"ba3cc151_b87b1f29","updated":"2015-07-06 22:38:26.000000000","message":"Fair enough.","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"4f60b362e42108bacfb4ea4956f9b002c83109b0","unresolved":false,"context_lines":[{"line_number":102,"context_line":"    def test_noscope_table(self):"},{"line_number":103,"context_line":"        rtm \u003d rt_tables.RoutingTablesManager(self.ns_name)"},{"line_number":104,"context_line":"        rtm.add(None)"},{"line_number":105,"context_line":"        self.assertEqual(\"noscope\", rtm.get(None).name)"}],"source_content_type":"text/x-python","patch_set":5,"id":"ba3cc151_38870f14","line":105,"updated":"2015-07-05 15:58:51.000000000","message":"Use constant name?","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"4892202178c328ea7fb233e45b57158d617b7cb1","unresolved":false,"context_lines":[{"line_number":102,"context_line":"    def test_noscope_table(self):"},{"line_number":103,"context_line":"        rtm \u003d rt_tables.RoutingTablesManager(self.ns_name)"},{"line_number":104,"context_line":"        rtm.add(None)"},{"line_number":105,"context_line":"        self.assertEqual(\"noscope\", rtm.get(None).name)"}],"source_content_type":"text/x-python","patch_set":5,"id":"ba3cc151_21eecc8b","line":105,"in_reply_to":"ba3cc151_38870f14","updated":"2015-07-06 22:38:26.000000000","message":"Okay.","commit_id":"7f781396d086b0b860e2f3b677da6f64e479e713"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"54fb370bb7a65d3c9d6ad95a87101bd73b456a18","unresolved":false,"context_lines":[{"line_number":31,"context_line":"    True and that it has a BASE_DIR constant which can be mocked to point to"},{"line_number":32,"context_line":"    /tmp."},{"line_number":33,"context_line":"    \"\"\""},{"line_number":34,"context_line":"    tmpdir \u003d tempfile.mkdtemp()"},{"line_number":35,"context_line":""},{"line_number":36,"context_line":"    # Execute that never runs as root"},{"line_number":37,"context_line":"    orig_execute \u003d linux_utils.execute"}],"source_content_type":"text/x-python","patch_set":17,"id":"5a2ca52d_b816d553","line":34,"updated":"2015-10-13 10:03:30.000000000","message":"It seems we can use instead:\n\n def inner(*args, **kwargs):\n   with  fixtures.TempDir() as tempdir:\n     with mock.patch","commit_id":"185f200b1c887044e26a5bd6019c88cef54e9abe"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"475200b4ee3e536a08e54f3dba09114f6f11822a","unresolved":false,"context_lines":[{"line_number":31,"context_line":"    True and that it has a BASE_DIR constant which can be mocked to point to"},{"line_number":32,"context_line":"    /tmp."},{"line_number":33,"context_line":"    \"\"\""},{"line_number":34,"context_line":"    tmpdir \u003d tempfile.mkdtemp()"},{"line_number":35,"context_line":""},{"line_number":36,"context_line":"    # Execute that never runs as root"},{"line_number":37,"context_line":"    orig_execute \u003d linux_utils.execute"}],"source_content_type":"text/x-python","patch_set":17,"id":"9a8ffd7b_eb5d3549","line":34,"in_reply_to":"5a2ca52d_b816d553","updated":"2015-12-01 00:56:59.000000000","message":"Done","commit_id":"185f200b1c887044e26a5bd6019c88cef54e9abe"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"54fb370bb7a65d3c9d6ad95a87101bd73b456a18","unresolved":false,"context_lines":[{"line_number":46,"context_line":"            with mock.patch.object(linux_utils, \u0027execute\u0027) as execute,\\"},{"line_number":47,"context_line":"                mock.patch.object(cls, \u0027BASE_DIR\u0027, tmpdir):"},{"line_number":48,"context_line":""},{"line_number":49,"context_line":"                execute.side_effect \u003d execute_no_root"},{"line_number":50,"context_line":"                function(*args, **kwargs)"},{"line_number":51,"context_line":"        finally:"},{"line_number":52,"context_line":"            shutil.rmtree(tmpdir)"}],"source_content_type":"text/x-python","patch_set":17,"id":"5a2ca52d_1b4b435b","line":49,"updated":"2015-10-13 10:03:30.000000000","message":"This really calls execute?","commit_id":"185f200b1c887044e26a5bd6019c88cef54e9abe"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"475200b4ee3e536a08e54f3dba09114f6f11822a","unresolved":false,"context_lines":[{"line_number":46,"context_line":"            with mock.patch.object(linux_utils, \u0027execute\u0027) as execute,\\"},{"line_number":47,"context_line":"                mock.patch.object(cls, \u0027BASE_DIR\u0027, tmpdir):"},{"line_number":48,"context_line":""},{"line_number":49,"context_line":"                execute.side_effect \u003d execute_no_root"},{"line_number":50,"context_line":"                function(*args, **kwargs)"},{"line_number":51,"context_line":"        finally:"},{"line_number":52,"context_line":"            shutil.rmtree(tmpdir)"}],"source_content_type":"text/x-python","patch_set":17,"id":"9a8ffd7b_31596c8f","line":49,"in_reply_to":"5a2ca52d_1b4b435b","updated":"2015-12-01 00:56:59.000000000","message":"I\u0027m not sure what you mean.","commit_id":"185f200b1c887044e26a5bd6019c88cef54e9abe"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"11650c886c3d197d558812042270f78bb26971ed","unresolved":false,"context_lines":[{"line_number":31,"context_line":"            cls \u003d rt_tables.NamespaceEtcDir"},{"line_number":32,"context_line":"            with mock.patch.object(cls, \u0027BASE_DIR\u0027, tmpdir.path):"},{"line_number":33,"context_line":"                function(*args, **kwargs)"},{"line_number":34,"context_line":"    return inner"},{"line_number":35,"context_line":""},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"class TestRoutingTablesManager(base.BaseTestCase):"}],"source_content_type":"text/x-python","patch_set":35,"id":"5a710552_f42137b5","line":34,"updated":"2015-12-16 14:59:57.000000000","message":"One thing I am curious about is why we\u0027re dealing with writing files in a unit test, I would have thought that belonged in a functional test ?","commit_id":"ad76ed585887c9b3aad224276367b221dc60bf79"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"bacc3d576727b1da36019f61ebf9ca616008df1e","unresolved":false,"context_lines":[{"line_number":31,"context_line":"            cls \u003d rt_tables.NamespaceEtcDir"},{"line_number":32,"context_line":"            with mock.patch.object(cls, \u0027BASE_DIR\u0027, tmpdir.path):"},{"line_number":33,"context_line":"                function(*args, **kwargs)"},{"line_number":34,"context_line":"    return inner"},{"line_number":35,"context_line":""},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"class TestRoutingTablesManager(base.BaseTestCase):"}],"source_content_type":"text/x-python","patch_set":35,"id":"3a7e1126_a18a2862","line":34,"in_reply_to":"3a7e1126_68aa0387","updated":"2015-12-21 21:51:06.000000000","message":"I don\u0027t think there is anything wrong with writing temp files in a unit test.","commit_id":"ad76ed585887c9b3aad224276367b221dc60bf79"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"32d3deea90a595dd246aad062e0ab5852599016e","unresolved":false,"context_lines":[{"line_number":31,"context_line":"            cls \u003d rt_tables.NamespaceEtcDir"},{"line_number":32,"context_line":"            with mock.patch.object(cls, \u0027BASE_DIR\u0027, tmpdir.path):"},{"line_number":33,"context_line":"                function(*args, **kwargs)"},{"line_number":34,"context_line":"    return inner"},{"line_number":35,"context_line":""},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"class TestRoutingTablesManager(base.BaseTestCase):"}],"source_content_type":"text/x-python","patch_set":35,"id":"3a7e1126_68aa0387","line":34,"in_reply_to":"5a710552_f42137b5","updated":"2015-12-21 10:56:03.000000000","message":"That is a good question.\n\nI believe it is acceptable for unit tests since it is aiming at verifying coverage and correct behaviour. The routine being tests writes to a file. If you mock the whole writing part you would be verifying coverage but not correct behaviour.\n\nThere could however be an alternative, which is to mock the calls that write to a file to assert that they\u0027re called with the correct parameters. This works only if the rest of the code being does not read back from the file, in which case one would need another mock with return_value properly set; in that case I\u0027d go for this approach as it is simpler.","commit_id":"ad76ed585887c9b3aad224276367b221dc60bf79"}]}
