)]}'
{"manila/share/drivers/container/driver.py":[{"author":{"_account_id":13998,"name":"Daniel Gonzalez Nothnagel","email":"daniel.gonzalez.nothnagel@sap.com","username":"dgonzalez"},"change_message_id":"0dc06a5a985962455cd19820469ca8539a892ff0","unresolved":false,"context_lines":[{"line_number":114,"context_line":"            return self._helpers[\"CIFS\"](self.container,"},{"line_number":115,"context_line":"                                         share\u003dshare,"},{"line_number":116,"context_line":"                                         config\u003dself.configuration)"},{"line_number":117,"context_line":"        if share[\"share_proto\"].upper() \u003d\u003d \"NFS\":"},{"line_number":118,"context_line":"            helper \u003d self._helpers.get(\"NFS\")"},{"line_number":119,"context_line":"            if helper is not None:"},{"line_number":120,"context_line":"                return helper(self.container,"}],"source_content_type":"text/x-python","patch_set":2,"id":"1aa78d24_734c8b9e","line":117,"range":{"start_line":117,"start_character":8,"end_line":117,"end_character":10},"updated":"2016-07-06 07:41:52.000000000","message":"I think this should be an \u0027elif\u0027","commit_id":"fa7020363f4d7ebddbace308af7cd0f8aaf5b0ac"},{"author":{"_account_id":6938,"name":"Alexey Ovchinnikov","email":"aovchinnikov@mirantis.com","username":"aovchinnikov"},"change_message_id":"817cd7847e83290793ae37c9288a237b9ebd1d7b","unresolved":false,"context_lines":[{"line_number":114,"context_line":"            return self._helpers[\"CIFS\"](self.container,"},{"line_number":115,"context_line":"                                         share\u003dshare,"},{"line_number":116,"context_line":"                                         config\u003dself.configuration)"},{"line_number":117,"context_line":"        if share[\"share_proto\"].upper() \u003d\u003d \"NFS\":"},{"line_number":118,"context_line":"            helper \u003d self._helpers.get(\"NFS\")"},{"line_number":119,"context_line":"            if helper is not None:"},{"line_number":120,"context_line":"                return helper(self.container,"}],"source_content_type":"text/x-python","patch_set":2,"id":"1aa78d24_ed39b7d8","line":117,"range":{"start_line":117,"start_character":8,"end_line":117,"end_character":10},"in_reply_to":"1aa78d24_734c8b9e","updated":"2016-07-06 08:44:27.000000000","message":"Yes, thank you!","commit_id":"fa7020363f4d7ebddbace308af7cd0f8aaf5b0ac"}],"manila/share/drivers/container/protocol_helper.py":[{"author":{"_account_id":13998,"name":"Daniel Gonzalez Nothnagel","email":"daniel.gonzalez.nothnagel@sap.com","username":"dgonzalez"},"change_message_id":"0dc06a5a985962455cd19820469ca8539a892ff0","unresolved":false,"context_lines":[{"line_number":202,"context_line":"            server_id,"},{"line_number":203,"context_line":"            [\"ip\", \"addr\", \"show\", \"eth0\"]"},{"line_number":204,"context_line":"        )[0].split(\u0027\\n\u0027)[2]"},{"line_number":205,"context_line":"        address \u003d re.findall(\"\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\", result)[0]"},{"line_number":206,"context_line":"        return address"},{"line_number":207,"context_line":""},{"line_number":208,"context_line":"    def create_share(self, server_id):"}],"source_content_type":"text/x-python","patch_set":2,"id":"1aa78d24_33a96325","line":205,"range":{"start_line":205,"start_character":8,"end_line":205,"end_character":77},"updated":"2016-07-06 07:41:52.000000000","message":"I would suggest doing\n\nmatch \u003d re.search(\"\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\", result)\nif match:\n    return match.group(0)\nelse:\n   throw SomeKindOfError\n\nThis way the regex will stop as soon as it has found its first match and not continue to find further matches, and you can handle errors more cleanly in case no address could be found (which admittedly shouldn\u0027t happen, but i think it\u0027s still better to handle the case properly).","commit_id":"fa7020363f4d7ebddbace308af7cd0f8aaf5b0ac"},{"author":{"_account_id":6938,"name":"Alexey Ovchinnikov","email":"aovchinnikov@mirantis.com","username":"aovchinnikov"},"change_message_id":"817cd7847e83290793ae37c9288a237b9ebd1d7b","unresolved":false,"context_lines":[{"line_number":202,"context_line":"            server_id,"},{"line_number":203,"context_line":"            [\"ip\", \"addr\", \"show\", \"eth0\"]"},{"line_number":204,"context_line":"        )[0].split(\u0027\\n\u0027)[2]"},{"line_number":205,"context_line":"        address \u003d re.findall(\"\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\", result)[0]"},{"line_number":206,"context_line":"        return address"},{"line_number":207,"context_line":""},{"line_number":208,"context_line":"    def create_share(self, server_id):"}],"source_content_type":"text/x-python","patch_set":2,"id":"1aa78d24_edc9b75a","line":205,"range":{"start_line":205,"start_character":8,"end_line":205,"end_character":77},"in_reply_to":"1aa78d24_33a96325","updated":"2016-07-06 08:44:27.000000000","message":"Well, it would be somewhat hard to get to this point without an address, but this is a better approach than mine.","commit_id":"fa7020363f4d7ebddbace308af7cd0f8aaf5b0ac"},{"author":{"_account_id":13998,"name":"Daniel Gonzalez Nothnagel","email":"daniel.gonzalez.nothnagel@sap.com","username":"dgonzalez"},"change_message_id":"0dc06a5a985962455cd19820469ca8539a892ff0","unresolved":false,"context_lines":[{"line_number":217,"context_line":"        # data."},{"line_number":218,"context_line":"        @utils.synchronized(\"config-lock-%s\" % filename, external\u003dTrue)"},{"line_number":219,"context_line":"        def inner_write_local_config():"},{"line_number":220,"context_line":"            f \u003d open(filename, \"w\")"},{"line_number":221,"context_line":"            f.write(config)"},{"line_number":222,"context_line":"            f.close()"},{"line_number":223,"context_line":""},{"line_number":224,"context_line":"        LOG.debug(\"Attempting to write to %s : %s\" % (filename, config))"},{"line_number":225,"context_line":"        return inner_write_local_config()"}],"source_content_type":"text/x-python","patch_set":2,"id":"1aa78d24_8e5aae28","line":222,"range":{"start_line":220,"start_character":12,"end_line":222,"end_character":21},"updated":"2016-07-06 07:41:52.000000000","message":"You could use \u0027with\u0027 here:\n\nwith open(filename, \u0027w\u0027) as f:\n    f.write(config)","commit_id":"fa7020363f4d7ebddbace308af7cd0f8aaf5b0ac"},{"author":{"_account_id":6938,"name":"Alexey Ovchinnikov","email":"aovchinnikov@mirantis.com","username":"aovchinnikov"},"change_message_id":"817cd7847e83290793ae37c9288a237b9ebd1d7b","unresolved":false,"context_lines":[{"line_number":217,"context_line":"        # data."},{"line_number":218,"context_line":"        @utils.synchronized(\"config-lock-%s\" % filename, external\u003dTrue)"},{"line_number":219,"context_line":"        def inner_write_local_config():"},{"line_number":220,"context_line":"            f \u003d open(filename, \"w\")"},{"line_number":221,"context_line":"            f.write(config)"},{"line_number":222,"context_line":"            f.close()"},{"line_number":223,"context_line":""},{"line_number":224,"context_line":"        LOG.debug(\"Attempting to write to %s : %s\" % (filename, config))"},{"line_number":225,"context_line":"        return inner_write_local_config()"}],"source_content_type":"text/x-python","patch_set":2,"id":"1aa78d24_ad868fd8","line":222,"range":{"start_line":220,"start_character":12,"end_line":222,"end_character":21},"in_reply_to":"1aa78d24_8e5aae28","updated":"2016-07-06 08:44:27.000000000","message":"I would prefer to keep it old style for now.","commit_id":"fa7020363f4d7ebddbace308af7cd0f8aaf5b0ac"},{"author":{"_account_id":13998,"name":"Daniel Gonzalez Nothnagel","email":"daniel.gonzalez.nothnagel@sap.com","username":"dgonzalez"},"change_message_id":"0dc06a5a985962455cd19820469ca8539a892ff0","unresolved":false,"context_lines":[{"line_number":265,"context_line":"    def _fetch_export_by_share(self, share_name, server_id):"},{"line_number":266,"context_line":"        # share_name should be a valid name inside pseudo file system."},{"line_number":267,"context_line":"        export_string \u003d self._get_exports(server_id)"},{"line_number":268,"context_line":"        result \u003d re.findall(\"uint16\\s*\\d\\s*string \\\"/%s.*\\\"\" % share_name,"},{"line_number":269,"context_line":"                            export_string)"},{"line_number":270,"context_line":"        return result"},{"line_number":271,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"1aa78d24_0e687e86","line":268,"range":{"start_line":268,"start_character":35,"end_line":268,"end_character":43},"updated":"2016-07-06 07:41:52.000000000","message":"Are you sure that there can be only one digit here (at the \\d)? If there can be more you need a + behind the \\d.","commit_id":"fa7020363f4d7ebddbace308af7cd0f8aaf5b0ac"},{"author":{"_account_id":6938,"name":"Alexey Ovchinnikov","email":"aovchinnikov@mirantis.com","username":"aovchinnikov"},"change_message_id":"817cd7847e83290793ae37c9288a237b9ebd1d7b","unresolved":false,"context_lines":[{"line_number":265,"context_line":"    def _fetch_export_by_share(self, share_name, server_id):"},{"line_number":266,"context_line":"        # share_name should be a valid name inside pseudo file system."},{"line_number":267,"context_line":"        export_string \u003d self._get_exports(server_id)"},{"line_number":268,"context_line":"        result \u003d re.findall(\"uint16\\s*\\d\\s*string \\\"/%s.*\\\"\" % share_name,"},{"line_number":269,"context_line":"                            export_string)"},{"line_number":270,"context_line":"        return result"},{"line_number":271,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"1aa78d24_2de1ff9a","line":268,"range":{"start_line":268,"start_character":35,"end_line":268,"end_character":43},"in_reply_to":"1aa78d24_0e687e86","updated":"2016-07-06 08:44:27.000000000","message":"Oh, thank you for catching this!","commit_id":"fa7020363f4d7ebddbace308af7cd0f8aaf5b0ac"},{"author":{"_account_id":13998,"name":"Daniel Gonzalez Nothnagel","email":"daniel.gonzalez.nothnagel@sap.com","username":"dgonzalez"},"change_message_id":"0dc06a5a985962455cd19820469ca8539a892ff0","unresolved":false,"context_lines":[{"line_number":271,"context_line":""},{"line_number":272,"context_line":"    def _get_new_export_id(self, server_id):"},{"line_number":273,"context_line":"        exports \u003d self._get_exports(server_id)"},{"line_number":274,"context_line":"        ids_in_use \u003d [int(x[7:]) for x in re.findall(\"uint16\\s*\\d\", exports)]"},{"line_number":275,"context_line":"        return str(max(ids_in_use) + 1)"},{"line_number":276,"context_line":""},{"line_number":277,"context_line":"    def delete_share(self, server_id):"}],"source_content_type":"text/x-python","patch_set":2,"id":"1aa78d24_ee7ed217","line":274,"range":{"start_line":274,"start_character":22,"end_line":274,"end_character":76},"updated":"2016-07-06 07:41:52.000000000","message":"I think this could be done more efficiently with\n\nint(x) for x in re.findall(\"uint16\\s*(\\d)\", exports)\n\ndue to the grouping used in the regex here, it is not necessary to slice the result in order to remove the \"uint16\" from the beginning of the string. Also, it does not require int() to cut off the whitespace from the front of x.\n\nAlso, like above, are you sure you only want to match one digit here? I think you should match for \\d+ instead of just \\d.","commit_id":"fa7020363f4d7ebddbace308af7cd0f8aaf5b0ac"},{"author":{"_account_id":6938,"name":"Alexey Ovchinnikov","email":"aovchinnikov@mirantis.com","username":"aovchinnikov"},"change_message_id":"817cd7847e83290793ae37c9288a237b9ebd1d7b","unresolved":false,"context_lines":[{"line_number":271,"context_line":""},{"line_number":272,"context_line":"    def _get_new_export_id(self, server_id):"},{"line_number":273,"context_line":"        exports \u003d self._get_exports(server_id)"},{"line_number":274,"context_line":"        ids_in_use \u003d [int(x[7:]) for x in re.findall(\"uint16\\s*\\d\", exports)]"},{"line_number":275,"context_line":"        return str(max(ids_in_use) + 1)"},{"line_number":276,"context_line":""},{"line_number":277,"context_line":"    def delete_share(self, server_id):"}],"source_content_type":"text/x-python","patch_set":2,"id":"1aa78d24_6dc307ee","line":274,"range":{"start_line":274,"start_character":22,"end_line":274,"end_character":76},"in_reply_to":"1aa78d24_ee7ed217","updated":"2016-07-06 08:44:27.000000000","message":"Good point about grouping, thank you! And like above -- ouch, sure \"+\" is missing.","commit_id":"fa7020363f4d7ebddbace308af7cd0f8aaf5b0ac"},{"author":{"_account_id":13998,"name":"Daniel Gonzalez Nothnagel","email":"daniel.gonzalez.nothnagel@sap.com","username":"dgonzalez"},"change_message_id":"0dc06a5a985962455cd19820469ca8539a892ff0","unresolved":false,"context_lines":[{"line_number":276,"context_line":""},{"line_number":277,"context_line":"    def delete_share(self, server_id):"},{"line_number":278,"context_line":"        share_name \u003d self.share.share_id"},{"line_number":279,"context_line":"        export_ids \u003d [x.split(\u0027\\n\u0027)[0][7:] for x in"},{"line_number":280,"context_line":"                      self._fetch_export_by_share(share_name, server_id)]"},{"line_number":281,"context_line":"        for export_id in export_ids:"},{"line_number":282,"context_line":"            self._remove_export(server_id, export_id)"}],"source_content_type":"text/x-python","patch_set":2,"id":"1aa78d24_2e80da8a","line":279,"range":{"start_line":279,"start_character":38,"end_line":279,"end_character":42},"updated":"2016-07-06 07:41:52.000000000","message":"If I understand this correctly, you try here again to remove the \"uint16\" from the front of the string. You could prevent that if you used a group in the regex in _fetch_export_by_share to directly capture the id of the export, instead of capturing the whole export.","commit_id":"fa7020363f4d7ebddbace308af7cd0f8aaf5b0ac"},{"author":{"_account_id":6938,"name":"Alexey Ovchinnikov","email":"aovchinnikov@mirantis.com","username":"aovchinnikov"},"change_message_id":"817cd7847e83290793ae37c9288a237b9ebd1d7b","unresolved":false,"context_lines":[{"line_number":276,"context_line":""},{"line_number":277,"context_line":"    def delete_share(self, server_id):"},{"line_number":278,"context_line":"        share_name \u003d self.share.share_id"},{"line_number":279,"context_line":"        export_ids \u003d [x.split(\u0027\\n\u0027)[0][7:] for x in"},{"line_number":280,"context_line":"                      self._fetch_export_by_share(share_name, server_id)]"},{"line_number":281,"context_line":"        for export_id in export_ids:"},{"line_number":282,"context_line":"            self._remove_export(server_id, export_id)"}],"source_content_type":"text/x-python","patch_set":2,"id":"1aa78d24_30a9547c","line":279,"range":{"start_line":279,"start_character":38,"end_line":279,"end_character":42},"in_reply_to":"1aa78d24_2e80da8a","updated":"2016-07-06 08:44:27.000000000","message":"Yes, proper grouping in a regex helps a lot, thank you!","commit_id":"fa7020363f4d7ebddbace308af7cd0f8aaf5b0ac"},{"author":{"_account_id":13998,"name":"Daniel Gonzalez Nothnagel","email":"daniel.gonzalez.nothnagel@sap.com","username":"dgonzalez"},"change_message_id":"0dc06a5a985962455cd19820469ca8539a892ff0","unresolved":false,"context_lines":[{"line_number":292,"context_line":"        if not (add_rules or delete_rules):"},{"line_number":293,"context_line":"            # Must clean all rules and add them anew."},{"line_number":294,"context_line":"            # This means taking every export id and removing it."},{"line_number":295,"context_line":"            export_ids \u003d [x[7:] for x in re.findall(\"uint16\\s*\\d*\","},{"line_number":296,"context_line":"                          self._get_exports(server_id))]"},{"line_number":297,"context_line":"            for export_id in export_ids:"},{"line_number":298,"context_line":"                self._remove_export(server_id, export_id)"},{"line_number":299,"context_line":"            for rule in access_rules:"}],"source_content_type":"text/x-python","patch_set":2,"id":"1aa78d24_ee27f2c7","line":296,"range":{"start_line":295,"start_character":26,"end_line":296,"end_character":55},"updated":"2016-07-06 07:41:52.000000000","message":"See my comments regarding the two regexes above.\nYou could again use grouping here instead of slicing the result.\n\nAlso, you should use \\d+ instead of \\d*. Else you could end up with an empty export ID if something is wrong with the format of the string, and that would lead to errors in _remove_export, because you would invoke bus-send with an empty id.","commit_id":"fa7020363f4d7ebddbace308af7cd0f8aaf5b0ac"},{"author":{"_account_id":6938,"name":"Alexey Ovchinnikov","email":"aovchinnikov@mirantis.com","username":"aovchinnikov"},"change_message_id":"817cd7847e83290793ae37c9288a237b9ebd1d7b","unresolved":false,"context_lines":[{"line_number":292,"context_line":"        if not (add_rules or delete_rules):"},{"line_number":293,"context_line":"            # Must clean all rules and add them anew."},{"line_number":294,"context_line":"            # This means taking every export id and removing it."},{"line_number":295,"context_line":"            export_ids \u003d [x[7:] for x in re.findall(\"uint16\\s*\\d*\","},{"line_number":296,"context_line":"                          self._get_exports(server_id))]"},{"line_number":297,"context_line":"            for export_id in export_ids:"},{"line_number":298,"context_line":"                self._remove_export(server_id, export_id)"},{"line_number":299,"context_line":"            for rule in access_rules:"}],"source_content_type":"text/x-python","patch_set":2,"id":"1aa78d24_30731417","line":296,"range":{"start_line":295,"start_character":26,"end_line":296,"end_character":55},"in_reply_to":"1aa78d24_ee27f2c7","updated":"2016-07-06 08:44:27.000000000","message":"Done","commit_id":"fa7020363f4d7ebddbace308af7cd0f8aaf5b0ac"},{"author":{"_account_id":13998,"name":"Daniel Gonzalez Nothnagel","email":"daniel.gonzalez.nothnagel@sap.com","username":"dgonzalez"},"change_message_id":"0dc06a5a985962455cd19820469ca8539a892ff0","unresolved":false,"context_lines":[{"line_number":396,"context_line":"        # per file with single RW clients block. RO will be added later on."},{"line_number":397,"context_line":"        out \u003d dict()"},{"line_number":398,"context_line":"        LOG.debug(\"Attempting to parse: %s\" % str(config))"},{"line_number":399,"context_line":"        out[\"export_id\"] \u003d re.findall(\"Export_ID \u003d \\d*\", config)[0][12:]"},{"line_number":400,"context_line":"        out[\"path_to_share\"] \u003d re.findall(\"Path \u003d \\\".*\\\"\", config)[0][8:-1]"},{"line_number":401,"context_line":"        out[\"share_name\"] \u003d re.findall(\"Pseudo \u003d \\\".*\\\"\", config)[0][11:-1]"},{"line_number":402,"context_line":"        out[\"client_ip\"] \u003d re.findall(\"Clients \u003d .*;\", config)[0][10:-1]"},{"line_number":403,"context_line":"        out[\"access_type\"] \u003d re.findall(\"Access_Type \u003d .*;\", config)[0][14:-1]"},{"line_number":404,"context_line":"        return out"},{"line_number":405,"context_line":""},{"line_number":406,"context_line":"    def _allow_access(self, server_id, access):"}],"source_content_type":"text/x-python","patch_set":2,"id":"1aa78d24_c94af025","line":403,"range":{"start_line":399,"start_character":8,"end_line":403,"end_character":78},"updated":"2016-07-06 07:41:52.000000000","message":"You should use grouping instead of slicing in all these regexes.\n\nYou could also consider using re.search instead if re.findall, as you are only interested in the first result you find, so it makes no sense to continue searching the config for further occurrences.","commit_id":"fa7020363f4d7ebddbace308af7cd0f8aaf5b0ac"},{"author":{"_account_id":6938,"name":"Alexey Ovchinnikov","email":"aovchinnikov@mirantis.com","username":"aovchinnikov"},"change_message_id":"817cd7847e83290793ae37c9288a237b9ebd1d7b","unresolved":false,"context_lines":[{"line_number":396,"context_line":"        # per file with single RW clients block. RO will be added later on."},{"line_number":397,"context_line":"        out \u003d dict()"},{"line_number":398,"context_line":"        LOG.debug(\"Attempting to parse: %s\" % str(config))"},{"line_number":399,"context_line":"        out[\"export_id\"] \u003d re.findall(\"Export_ID \u003d \\d*\", config)[0][12:]"},{"line_number":400,"context_line":"        out[\"path_to_share\"] \u003d re.findall(\"Path \u003d \\\".*\\\"\", config)[0][8:-1]"},{"line_number":401,"context_line":"        out[\"share_name\"] \u003d re.findall(\"Pseudo \u003d \\\".*\\\"\", config)[0][11:-1]"},{"line_number":402,"context_line":"        out[\"client_ip\"] \u003d re.findall(\"Clients \u003d .*;\", config)[0][10:-1]"},{"line_number":403,"context_line":"        out[\"access_type\"] \u003d re.findall(\"Access_Type \u003d .*;\", config)[0][14:-1]"},{"line_number":404,"context_line":"        return out"},{"line_number":405,"context_line":""},{"line_number":406,"context_line":"    def _allow_access(self, server_id, access):"}],"source_content_type":"text/x-python","patch_set":2,"id":"1aa78d24_108c18d9","line":403,"range":{"start_line":399,"start_character":8,"end_line":403,"end_character":78},"in_reply_to":"1aa78d24_c94af025","updated":"2016-07-06 08:44:27.000000000","message":"Yes, thank you!","commit_id":"fa7020363f4d7ebddbace308af7cd0f8aaf5b0ac"}]}
