)]}'
{"ironic/common/utils.py":[{"author":{"_account_id":12356,"name":"Vladyslav Drok","email":"vdrok@mirantis.com","username":"vdrok"},"change_message_id":"2da0be43d85df8b3c9521b6a6b1644da8205694b","unresolved":false,"context_lines":[{"line_number":286,"context_line":"def is_valid_ipv6_cidr(address):"},{"line_number":287,"context_line":"    try:"},{"line_number":288,"context_line":"        netaddr.IPNetwork(address, version\u003d6).cidr"},{"line_number":289,"context_line":"    except (TypeError, netaddr.AddrFormatError):"},{"line_number":290,"context_line":"        return False"},{"line_number":291,"context_line":"    return True"},{"line_number":292,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"bab6814e_24edceef","line":289,"updated":"2016-05-25 10:51:15.000000000","message":"It seems to me that ValueError is also possible, from IPAddress constructor. Also, do we really want to rely on the internal netaddr exception handling? In this particular case, to just determine if an address is valid or not except Exception seems to be OK. Let\u0027s see what others think.","commit_id":"a4965382d4d530e390c087a2225822b3ab40fd48"},{"author":{"_account_id":10485,"name":"Ankit Agrawal","email":"ankitagrawal8188@gmail.com","username":"ankitagrawal"},"change_message_id":"a6c6eae57eb581415990e998258cfa8848b44eba","unresolved":false,"context_lines":[{"line_number":286,"context_line":"def is_valid_ipv6_cidr(address):"},{"line_number":287,"context_line":"    try:"},{"line_number":288,"context_line":"        netaddr.IPNetwork(address, version\u003d6).cidr"},{"line_number":289,"context_line":"    except (TypeError, netaddr.AddrFormatError):"},{"line_number":290,"context_line":"        return False"},{"line_number":291,"context_line":"    return True"},{"line_number":292,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"bab6814e_b3ea9eaa","line":289,"in_reply_to":"bab6814e_0d038d43","updated":"2016-05-25 12:19:02.000000000","message":"Thanks for the reference. Should we also add ValueError in the exceptions to handle this case or should leave as it is to catch generic exception?","commit_id":"a4965382d4d530e390c087a2225822b3ab40fd48"},{"author":{"_account_id":14525,"name":"Vasyl Saienko","email":"vsaienko@mirantis.com","username":"vsaienko"},"change_message_id":"e2dd77ff5b178212e5c3ca3af75dfbd1f9a7cb41","unresolved":false,"context_lines":[{"line_number":286,"context_line":"def is_valid_ipv6_cidr(address):"},{"line_number":287,"context_line":"    try:"},{"line_number":288,"context_line":"        netaddr.IPNetwork(address, version\u003d6).cidr"},{"line_number":289,"context_line":"    except (TypeError, netaddr.AddrFormatError):"},{"line_number":290,"context_line":"        return False"},{"line_number":291,"context_line":"    return True"},{"line_number":292,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"bab6814e_6766b82a","line":289,"in_reply_to":"bab6814e_24edceef","updated":"2016-05-25 11:18:22.000000000","message":"ValueError is possible if version parameter is invalid, eg version\u003d7.\n\nI don\u0027t have any strong opinion on this. But definitely it should be covered by unittests.","commit_id":"a4965382d4d530e390c087a2225822b3ab40fd48"},{"author":{"_account_id":11076,"name":"Shivanand Tendulker","email":"stendulker@gmail.com","username":"stendulker"},"change_message_id":"9c8c0c0db9578edb4d6284d93f22337a0c0285a4","unresolved":false,"context_lines":[{"line_number":286,"context_line":"def is_valid_ipv6_cidr(address):"},{"line_number":287,"context_line":"    try:"},{"line_number":288,"context_line":"        netaddr.IPNetwork(address, version\u003d6).cidr"},{"line_number":289,"context_line":"    except (TypeError, netaddr.AddrFormatError):"},{"line_number":290,"context_line":"        return False"},{"line_number":291,"context_line":"    return True"},{"line_number":292,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"bab6814e_7f18f484","line":289,"in_reply_to":"bab6814e_5e77f939","updated":"2016-05-25 13:56:06.000000000","message":"+1 \nIt does not make sense to mention every exception when behavior defined for all the exceptions is going to be same.","commit_id":"a4965382d4d530e390c087a2225822b3ab40fd48"},{"author":{"_account_id":10485,"name":"Ankit Agrawal","email":"ankitagrawal8188@gmail.com","username":"ankitagrawal"},"change_message_id":"3c351f7b62a986e78958ab03f0e189d47abc288a","unresolved":false,"context_lines":[{"line_number":286,"context_line":"def is_valid_ipv6_cidr(address):"},{"line_number":287,"context_line":"    try:"},{"line_number":288,"context_line":"        netaddr.IPNetwork(address, version\u003d6).cidr"},{"line_number":289,"context_line":"    except (TypeError, netaddr.AddrFormatError):"},{"line_number":290,"context_line":"        return False"},{"line_number":291,"context_line":"    return True"},{"line_number":292,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"bab6814e_6d6179a8","line":289,"in_reply_to":"bab6814e_6766b82a","updated":"2016-05-25 11:40:24.000000000","message":"This \"is_valid_ipv6_cidr\" method will never raise \"ValueError\" because \"version\" is passed statically to netaddr.IPNetwork and \"is_valid_ipv6_cidr\" method only excepts \"address\".\n\n\n\"is_valid_ipv6_cidr\" method can only raise TypeError or netaddr.AddrFormatError for any possible values passed for \"address\".\n\n\nAccording to openstack standards [1] we should catch specific exception wherever possible.\n\n\nUnit test case is already there [2] to test this method.\n\n\n[1] http://docs.openstack.org/developer/hacking/#general\n[2] https://github.com/openstack/ironic/blob/master/ironic/tests/unit/common/test_utils.py#L340","commit_id":"a4965382d4d530e390c087a2225822b3ab40fd48"},{"author":{"_account_id":12356,"name":"Vladyslav Drok","email":"vdrok@mirantis.com","username":"vdrok"},"change_message_id":"e4078fa0593e19965f93d54cb645794affdf66d0","unresolved":false,"context_lines":[{"line_number":286,"context_line":"def is_valid_ipv6_cidr(address):"},{"line_number":287,"context_line":"    try:"},{"line_number":288,"context_line":"        netaddr.IPNetwork(address, version\u003d6).cidr"},{"line_number":289,"context_line":"    except (TypeError, netaddr.AddrFormatError):"},{"line_number":290,"context_line":"        return False"},{"line_number":291,"context_line":"    return True"},{"line_number":292,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"bab6814e_0d038d43","line":289,"in_reply_to":"bab6814e_6d6179a8","updated":"2016-05-25 12:12:02.000000000","message":"In [10]: netaddr.IPNetwork(\u0027abcd:ef01:2345:6789:abcd:ef01:192.168.254.254/48/20\u0027, version\u003d6)\n\nValueError: IPAddress() does not support netmasks or subnet prefixes! See documentation for details.","commit_id":"a4965382d4d530e390c087a2225822b3ab40fd48"},{"author":{"_account_id":12356,"name":"Vladyslav Drok","email":"vdrok@mirantis.com","username":"vdrok"},"change_message_id":"7500d2947c1fbb9687d19191584389bc4af6cde1","unresolved":false,"context_lines":[{"line_number":286,"context_line":"def is_valid_ipv6_cidr(address):"},{"line_number":287,"context_line":"    try:"},{"line_number":288,"context_line":"        netaddr.IPNetwork(address, version\u003d6).cidr"},{"line_number":289,"context_line":"    except (TypeError, netaddr.AddrFormatError):"},{"line_number":290,"context_line":"        return False"},{"line_number":291,"context_line":"    return True"},{"line_number":292,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"bab6814e_5e77f939","line":289,"in_reply_to":"bab6814e_b3ea9eaa","updated":"2016-05-25 12:28:49.000000000","message":"So, while the hacking says what it says, in this particular case we don\u0027t care, any exception means that the address is not valid. If we add this, will we have to track which exceptions are added to netaddr parser? I\u0027d prefer not to.","commit_id":"a4965382d4d530e390c087a2225822b3ab40fd48"}]}
