)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"fb82e9d6f2279a0cf968aa33b22367078471b16e","unresolved":false,"context_lines":[{"line_number":10,"context_line":"neutron-fwaas API definition."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Change-Id: If49391647dfa0cb1eeca4c80abdc7397eb639675"},{"line_number":13,"context_line":"Needed-By: I7b4108772e8370e8f51971caf40ecd23e9f977e9"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"3a71b18c_2eeab80f","line":13,"updated":"2016-12-09 23:41:45.000000000","message":"please avoid using this in patches for the same repo. Rebase.","commit_id":"7b22ff7d982016f09b53b027b81ad089dec60fbe"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"f4f9ea9d762c0aa337e585f7e0acd1fc74dc6fac","unresolved":false,"context_lines":[{"line_number":10,"context_line":"neutron-fwaas API definition."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Change-Id: If49391647dfa0cb1eeca4c80abdc7397eb639675"},{"line_number":13,"context_line":"Needed-By: I7b4108772e8370e8f51971caf40ecd23e9f977e9"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"1a6eadb0_fabc386e","line":13,"in_reply_to":"3a71b18c_2eeab80f","updated":"2016-12-13 21:43:26.000000000","message":"Done","commit_id":"7b22ff7d982016f09b53b027b81ad089dec60fbe"}],"neutron_lib/api/converters.py":[{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"3916d02afec9b1a89ef78fbf275b33d0c2618a1f","unresolved":false,"context_lines":[{"line_number":184,"context_line":"    return value"},{"line_number":185,"context_line":""},{"line_number":186,"context_line":""},{"line_number":187,"context_line":"def convert_to_string(data):"},{"line_number":188,"context_line":"    \"\"\"Convert a value into a string."},{"line_number":189,"context_line":""},{"line_number":190,"context_line":"    :param data: The value to convert."}],"source_content_type":"text/x-python","patch_set":10,"id":"1a6eadb0_50d93121","line":187,"range":{"start_line":187,"start_character":4,"end_line":187,"end_character":21},"updated":"2016-12-15 13:38:38.000000000","message":"Just looking at the other converters naming in this file, it seems the convention is to use \u003cconvert_to_thetype\u003e_if_not_none\nfor these that only convert non-None data.","commit_id":"9d2e858cd122568903a6cdcd47f941b9746bd9f5"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"ccff6267c77f8514b7ebbc3497039696a0e65e54","unresolved":false,"context_lines":[{"line_number":184,"context_line":"    return value"},{"line_number":185,"context_line":""},{"line_number":186,"context_line":""},{"line_number":187,"context_line":"def convert_to_string(data):"},{"line_number":188,"context_line":"    \"\"\"Convert a value into a string."},{"line_number":189,"context_line":""},{"line_number":190,"context_line":"    :param data: The value to convert."}],"source_content_type":"text/x-python","patch_set":10,"id":"1a6eadb0_4d5b4ff6","line":187,"range":{"start_line":187,"start_character":4,"end_line":187,"end_character":21},"in_reply_to":"1a6eadb0_50d93121","updated":"2016-12-15 17:42:17.000000000","message":"Good point.  Changed the name to convert_to_string_if_not_none.","commit_id":"9d2e858cd122568903a6cdcd47f941b9746bd9f5"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"3916d02afec9b1a89ef78fbf275b33d0c2618a1f","unresolved":false,"context_lines":[{"line_number":190,"context_line":"    :param data: The value to convert."},{"line_number":191,"context_line":"    :return: The string representation of the value, or None is \u0027data\u0027 is None."},{"line_number":192,"context_line":"    \"\"\""},{"line_number":193,"context_line":"    if data is None:"},{"line_number":194,"context_line":"        return"},{"line_number":195,"context_line":"    else:"},{"line_number":196,"context_line":"        return str(data)"},{"line_number":197,"context_line":""},{"line_number":198,"context_line":""},{"line_number":199,"context_line":"def convert_string_to_case_insensitive(data):"}],"source_content_type":"text/x-python","patch_set":10,"id":"1a6eadb0_f0379d4a","line":196,"range":{"start_line":193,"start_character":0,"end_line":196,"end_character":24},"updated":"2016-12-15 13:38:38.000000000","message":"Nit: we *could* collapse this into something like::\n\n    return str(data) if data is not None else None","commit_id":"9d2e858cd122568903a6cdcd47f941b9746bd9f5"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"ccff6267c77f8514b7ebbc3497039696a0e65e54","unresolved":false,"context_lines":[{"line_number":190,"context_line":"    :param data: The value to convert."},{"line_number":191,"context_line":"    :return: The string representation of the value, or None is \u0027data\u0027 is None."},{"line_number":192,"context_line":"    \"\"\""},{"line_number":193,"context_line":"    if data is None:"},{"line_number":194,"context_line":"        return"},{"line_number":195,"context_line":"    else:"},{"line_number":196,"context_line":"        return str(data)"},{"line_number":197,"context_line":""},{"line_number":198,"context_line":""},{"line_number":199,"context_line":"def convert_string_to_case_insensitive(data):"}],"source_content_type":"text/x-python","patch_set":10,"id":"1a6eadb0_0d3317ac","line":196,"range":{"start_line":193,"start_character":0,"end_line":196,"end_character":24},"in_reply_to":"1a6eadb0_f0379d4a","updated":"2016-12-15 17:42:17.000000000","message":"Hmm, I think the \u0027else\u0027 is not needed, since None is what is returned if the else is not executed.  Changed to:\n\n    return str(data) if data is not None","commit_id":"9d2e858cd122568903a6cdcd47f941b9746bd9f5"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"3916d02afec9b1a89ef78fbf275b33d0c2618a1f","unresolved":false,"context_lines":[{"line_number":209,"context_line":"    if data is None:"},{"line_number":210,"context_line":"        return"},{"line_number":211,"context_line":"    else:"},{"line_number":212,"context_line":"        return data.lower()"},{"line_number":213,"context_line":""},{"line_number":214,"context_line":""},{"line_number":215,"context_line":"def convert_protocol(data):"}],"source_content_type":"text/x-python","patch_set":10,"id":"1a6eadb0_90ef4986","line":212,"range":{"start_line":212,"start_character":15,"end_line":212,"end_character":27},"updated":"2016-12-15 13:38:38.000000000","message":"If data is not a string type, this will raise. Based on the other converters it seems we should catch the exception and then reraise a InvalidInput error like other converters do.","commit_id":"9d2e858cd122568903a6cdcd47f941b9746bd9f5"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"ccff6267c77f8514b7ebbc3497039696a0e65e54","unresolved":false,"context_lines":[{"line_number":209,"context_line":"    if data is None:"},{"line_number":210,"context_line":"        return"},{"line_number":211,"context_line":"    else:"},{"line_number":212,"context_line":"        return data.lower()"},{"line_number":213,"context_line":""},{"line_number":214,"context_line":""},{"line_number":215,"context_line":"def convert_protocol(data):"}],"source_content_type":"text/x-python","patch_set":10,"id":"1a6eadb0_adef83e7","line":212,"range":{"start_line":212,"start_character":15,"end_line":212,"end_character":27},"in_reply_to":"1a6eadb0_90ef4986","updated":"2016-12-15 17:42:17.000000000","message":"Sucked in the changes from https://review.openstack.org/#/c/411041/2/neutron_lib/api/converters.py that accomplish this.","commit_id":"9d2e858cd122568903a6cdcd47f941b9746bd9f5"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"3916d02afec9b1a89ef78fbf275b33d0c2618a1f","unresolved":false,"context_lines":[{"line_number":226,"context_line":"    names."},{"line_number":227,"context_line":"    \"\"\""},{"line_number":228,"context_line":""},{"line_number":229,"context_line":"    # Rather than repeat this multiple places below, prep it once."},{"line_number":230,"context_line":"    error_message \u003d (\"IP protocol \u0027%s\u0027 is not supported. Only protocol \""},{"line_number":231,"context_line":"                     \"values %s and their integer representation (0 to \""},{"line_number":232,"context_line":"                     \"255) are supported\""}],"source_content_type":"text/x-python","patch_set":10,"id":"1a6eadb0_f06f9df9","line":229,"updated":"2016-12-15 13:38:38.000000000","message":"I only see it used once below, so not sure why this comment is needed.","commit_id":"9d2e858cd122568903a6cdcd47f941b9746bd9f5"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"ccff6267c77f8514b7ebbc3497039696a0e65e54","unresolved":false,"context_lines":[{"line_number":226,"context_line":"    names."},{"line_number":227,"context_line":"    \"\"\""},{"line_number":228,"context_line":""},{"line_number":229,"context_line":"    # Rather than repeat this multiple places below, prep it once."},{"line_number":230,"context_line":"    error_message \u003d (\"IP protocol \u0027%s\u0027 is not supported. Only protocol \""},{"line_number":231,"context_line":"                     \"values %s and their integer representation (0 to \""},{"line_number":232,"context_line":"                     \"255) are supported\""}],"source_content_type":"text/x-python","patch_set":10,"id":"1a6eadb0_adc6a365","line":229,"in_reply_to":"1a6eadb0_f06f9df9","updated":"2016-12-15 17:42:17.000000000","message":"Removed comment and moved code next to where it will be used.","commit_id":"9d2e858cd122568903a6cdcd47f941b9746bd9f5"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"4317ca1b463469f82c9aa1950ef1acd602300ef7","unresolved":false,"context_lines":[{"line_number":190,"context_line":"    :param data: The value to convert."},{"line_number":191,"context_line":"    :return: The string representation of the value, or None is \u0027data\u0027 is None."},{"line_number":192,"context_line":"    \"\"\""},{"line_number":193,"context_line":"    return str(data) if data is not None else None"},{"line_number":194,"context_line":""},{"line_number":195,"context_line":""},{"line_number":196,"context_line":"def convert_string_to_case_insensitive(data):"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_fad91df4","line":193,"updated":"2016-12-16 01:59:19.000000000","message":"string is a \u0027native\u0027 type, I don\u0027t believe this is needed at all. In fact there\u0027s no such \u0027basic\u0027 converter anywhere in neutron-land. Are you sure this is really required?","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"7ed3ea73f1b7dcd12bda3afbfab3141e52db9fb0","unresolved":false,"context_lines":[{"line_number":190,"context_line":"    :param data: The value to convert."},{"line_number":191,"context_line":"    :return: The string representation of the value, or None is \u0027data\u0027 is None."},{"line_number":192,"context_line":"    \"\"\""},{"line_number":193,"context_line":"    return str(data) if data is not None else None"},{"line_number":194,"context_line":""},{"line_number":195,"context_line":""},{"line_number":196,"context_line":"def convert_string_to_case_insensitive(data):"}],"source_content_type":"text/x-python","patch_set":14,"id":"da4df55a_95fe3bac","line":193,"in_reply_to":"1a6eadb0_de844c0c","updated":"2017-01-03 21:22:26.000000000","message":"I converted it because it was there, and I couldn\u0027t prove to myself that it wasn\u0027t needed.  But I\u0027ll remove it because you have confirmed my suspicions.","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":17776,"name":"Reedip","email":"reedip.banerjee@gmail.com","username":"Reedip"},"change_message_id":"e60a9d531e0eab1591363e30a40aee117f097250","unresolved":false,"context_lines":[{"line_number":190,"context_line":"    :param data: The value to convert."},{"line_number":191,"context_line":"    :return: The string representation of the value, or None is \u0027data\u0027 is None."},{"line_number":192,"context_line":"    \"\"\""},{"line_number":193,"context_line":"    return str(data) if data is not None else None"},{"line_number":194,"context_line":""},{"line_number":195,"context_line":""},{"line_number":196,"context_line":"def convert_string_to_case_insensitive(data):"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_de844c0c","line":193,"in_reply_to":"1a6eadb0_fad91df4","updated":"2016-12-16 07:23:37.000000000","message":"Most of the information we get via the REST API is string, and thats probably why we have convert_to_int and convert_to_boolean. Do we really need a convert_to_string ?","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"4317ca1b463469f82c9aa1950ef1acd602300ef7","unresolved":false,"context_lines":[{"line_number":203,"context_line":"    \u0027data\u0027 is None."},{"line_number":204,"context_line":"    :raises InvalidInput: If the value is not a string."},{"line_number":205,"context_line":"    \"\"\""},{"line_number":206,"context_line":"    if data is None:"},{"line_number":207,"context_line":"        return"},{"line_number":208,"context_line":"    elif not isinstance(data, six.string_types):"},{"line_number":209,"context_line":"        error_message \u003d (\"Input value %s must be string type.\") % data"},{"line_number":210,"context_line":"        raise n_exc.InvalidInput(error_message\u003derror_message)"},{"line_number":211,"context_line":"    else:"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_45b4f633","line":208,"range":{"start_line":206,"start_character":4,"end_line":208,"end_character":48},"updated":"2016-12-16 01:59:19.000000000","message":"this would be a lot less verbose if you just caught AttributeError on data.lower(), which is more pythonic.","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":17776,"name":"Reedip","email":"reedip.banerjee@gmail.com","username":"Reedip"},"change_message_id":"e60a9d531e0eab1591363e30a40aee117f097250","unresolved":false,"context_lines":[{"line_number":203,"context_line":"    \u0027data\u0027 is None."},{"line_number":204,"context_line":"    :raises InvalidInput: If the value is not a string."},{"line_number":205,"context_line":"    \"\"\""},{"line_number":206,"context_line":"    if data is None:"},{"line_number":207,"context_line":"        return"},{"line_number":208,"context_line":"    elif not isinstance(data, six.string_types):"},{"line_number":209,"context_line":"        error_message \u003d (\"Input value %s must be string type.\") % data"},{"line_number":210,"context_line":"        raise n_exc.InvalidInput(error_message\u003derror_message)"},{"line_number":211,"context_line":"    else:"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_dead2c9c","line":208,"range":{"start_line":206,"start_character":4,"end_line":208,"end_character":48},"in_reply_to":"1a6eadb0_45b4f633","updated":"2016-12-16 07:23:37.000000000","message":"+1","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"7ed3ea73f1b7dcd12bda3afbfab3141e52db9fb0","unresolved":false,"context_lines":[{"line_number":203,"context_line":"    \u0027data\u0027 is None."},{"line_number":204,"context_line":"    :raises InvalidInput: If the value is not a string."},{"line_number":205,"context_line":"    \"\"\""},{"line_number":206,"context_line":"    if data is None:"},{"line_number":207,"context_line":"        return"},{"line_number":208,"context_line":"    elif not isinstance(data, six.string_types):"},{"line_number":209,"context_line":"        error_message \u003d (\"Input value %s must be string type.\") % data"},{"line_number":210,"context_line":"        raise n_exc.InvalidInput(error_message\u003derror_message)"},{"line_number":211,"context_line":"    else:"}],"source_content_type":"text/x-python","patch_set":14,"id":"da4df55a_75c63769","line":208,"range":{"start_line":206,"start_character":4,"end_line":208,"end_character":48},"in_reply_to":"1a6eadb0_dead2c9c","updated":"2017-01-03 21:22:26.000000000","message":"Done","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"4317ca1b463469f82c9aa1950ef1acd602300ef7","unresolved":false,"context_lines":[{"line_number":213,"context_line":""},{"line_number":214,"context_line":""},{"line_number":215,"context_line":"def convert_protocol(data):"},{"line_number":216,"context_line":"    \"\"\"Validate that a specified IP protocol is valid."},{"line_number":217,"context_line":""},{"line_number":218,"context_line":"    For the authoritative list mapping protocol names to numbers, see the IANA:"},{"line_number":219,"context_line":"    http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_4544f6b5","line":216,"range":{"start_line":216,"start_character":48,"end_line":216,"end_character":53},"updated":"2016-12-16 01:59:19.000000000","message":"I feel this method is doing more than it\u0027s supposed to do, which is to convert data into a legitimate label or number to identify a protocol. Whether this is a valid IP protocol, should be the job of a validator.\n\nBesides, a protocol as a number is acceptable, but then if I specify it as a literal it\u0027s not? That\u0027s some lousy API usability.\n\nMy suggestion is to rework the split of responsibility between converter and validator phases so that these can be more easily reusable across projects.","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"4317ca1b463469f82c9aa1950ef1acd602300ef7","unresolved":false,"context_lines":[{"line_number":220,"context_line":""},{"line_number":221,"context_line":"    :param data: The value to verify is an IP protocol."},{"line_number":222,"context_line":"    :returns: If data is an int between 0 and 255 or None, return that; if"},{"line_number":223,"context_line":"    data is a string then return it lower-cased."},{"line_number":224,"context_line":"    :raises exceptions.InvalidInput: If data is an int \u003c 0, an"},{"line_number":225,"context_line":"    int \u003e 255, or a string that does not match one of the allowed protocol"},{"line_number":226,"context_line":"    names."}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_850b6ed5","line":223,"range":{"start_line":223,"start_character":9,"end_line":223,"end_character":47},"updated":"2016-12-16 01:59:19.000000000","message":"this is not what the validator does, you only validate a subset of well known string representations of IP protocols.","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"7ed3ea73f1b7dcd12bda3afbfab3141e52db9fb0","unresolved":false,"context_lines":[{"line_number":220,"context_line":""},{"line_number":221,"context_line":"    :param data: The value to verify is an IP protocol."},{"line_number":222,"context_line":"    :returns: If data is an int between 0 and 255 or None, return that; if"},{"line_number":223,"context_line":"    data is a string then return it lower-cased."},{"line_number":224,"context_line":"    :raises exceptions.InvalidInput: If data is an int \u003c 0, an"},{"line_number":225,"context_line":"    int \u003e 255, or a string that does not match one of the allowed protocol"},{"line_number":226,"context_line":"    names."}],"source_content_type":"text/x-python","patch_set":14,"id":"ba5201f7_63ba5a25","line":223,"range":{"start_line":223,"start_character":9,"end_line":223,"end_character":47},"in_reply_to":"1a6eadb0_850b6ed5","updated":"2017-01-03 21:22:26.000000000","message":"Done","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":17776,"name":"Reedip","email":"reedip.banerjee@gmail.com","username":"Reedip"},"change_message_id":"e60a9d531e0eab1591363e30a40aee117f097250","unresolved":false,"context_lines":[{"line_number":227,"context_line":"    \"\"\""},{"line_number":228,"context_line":""},{"line_number":229,"context_line":"    val \u003d None"},{"line_number":230,"context_line":"    if data is None:"},{"line_number":231,"context_line":"        return"},{"line_number":232,"context_line":"    if isinstance(data, six.text_type):"},{"line_number":233,"context_line":"        if data.isdigit():"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_9e1814d5","line":230,"range":{"start_line":230,"start_character":7,"end_line":230,"end_character":11},"updated":"2016-12-16 07:23:37.000000000","message":"You know what ?\nIf we use the validator \"validate_string_or_none\" then we do not need to check \"if data is None\" in half of the following functions, isnt it?","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"7ed3ea73f1b7dcd12bda3afbfab3141e52db9fb0","unresolved":false,"context_lines":[{"line_number":227,"context_line":"    \"\"\""},{"line_number":228,"context_line":""},{"line_number":229,"context_line":"    val \u003d None"},{"line_number":230,"context_line":"    if data is None:"},{"line_number":231,"context_line":"        return"},{"line_number":232,"context_line":"    if isinstance(data, six.text_type):"},{"line_number":233,"context_line":"        if data.isdigit():"}],"source_content_type":"text/x-python","patch_set":14,"id":"ba5201f7_03b42ecf","line":230,"range":{"start_line":230,"start_character":7,"end_line":230,"end_character":11},"in_reply_to":"1a6eadb0_9e1814d5","updated":"2017-01-03 21:22:26.000000000","message":"I\u0027m not quite sure what you mean... if data is a string we process it, but if data is None then we return immediately.  Since we have two different logical behaviors depending on string-or-none then how does using that help us here?\n\nIt does however allow us to avoid the \"if isinstance(data, six.text_type)\" so I will use it there.","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":17776,"name":"Reedip","email":"reedip.banerjee@gmail.com","username":"Reedip"},"change_message_id":"e60a9d531e0eab1591363e30a40aee117f097250","unresolved":false,"context_lines":[{"line_number":232,"context_line":"    if isinstance(data, six.text_type):"},{"line_number":233,"context_line":"        if data.isdigit():"},{"line_number":234,"context_line":"            val \u003d int(data)"},{"line_number":235,"context_line":"    if isinstance(data, six.integer_types):"},{"line_number":236,"context_line":"        val \u003d data"},{"line_number":237,"context_line":"    if val is not None and 0 \u003c\u003d val \u003c\u003d 255:"},{"line_number":238,"context_line":"        return val"},{"line_number":239,"context_line":"    elif data.lower() in constants.IPTABLES_VALID_PROTOCOLS:"},{"line_number":240,"context_line":"        return data.lower()"},{"line_number":241,"context_line":"    else:"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_3edb801c","line":238,"range":{"start_line":235,"start_character":0,"end_line":238,"end_character":18},"updated":"2016-12-16 07:23:37.000000000","message":"Do you really need the val variable ?","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"7ed3ea73f1b7dcd12bda3afbfab3141e52db9fb0","unresolved":false,"context_lines":[{"line_number":232,"context_line":"    if isinstance(data, six.text_type):"},{"line_number":233,"context_line":"        if data.isdigit():"},{"line_number":234,"context_line":"            val \u003d int(data)"},{"line_number":235,"context_line":"    if isinstance(data, six.integer_types):"},{"line_number":236,"context_line":"        val \u003d data"},{"line_number":237,"context_line":"    if val is not None and 0 \u003c\u003d val \u003c\u003d 255:"},{"line_number":238,"context_line":"        return val"},{"line_number":239,"context_line":"    elif data.lower() in constants.IPTABLES_VALID_PROTOCOLS:"},{"line_number":240,"context_line":"        return data.lower()"},{"line_number":241,"context_line":"    else:"}],"source_content_type":"text/x-python","patch_set":14,"id":"ba5201f7_c3a4e6ba","line":238,"range":{"start_line":235,"start_character":0,"end_line":238,"end_character":18},"in_reply_to":"1a6eadb0_3edb801c","updated":"2017-01-03 21:22:26.000000000","message":"Well, I reference it twice: in the \"0 \u003c\u003d val \u003c\u003d 255\" and then in the return.  I think it\u0027s good style to create a variable if you\u0027re going to reference the result of a function more than once - at least, that\u0027s what my CS professor in college drilled in to me.","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"4317ca1b463469f82c9aa1950ef1acd602300ef7","unresolved":false,"context_lines":[{"line_number":226,"context_line":"    names."},{"line_number":227,"context_line":"    \"\"\""},{"line_number":228,"context_line":""},{"line_number":229,"context_line":"    val \u003d None"},{"line_number":230,"context_line":"    if data is None:"},{"line_number":231,"context_line":"        return"},{"line_number":232,"context_line":"    if isinstance(data, six.text_type):"},{"line_number":233,"context_line":"        if data.isdigit():"},{"line_number":234,"context_line":"            val \u003d int(data)"},{"line_number":235,"context_line":"    if isinstance(data, six.integer_types):"},{"line_number":236,"context_line":"        val \u003d data"},{"line_number":237,"context_line":"    if val is not None and 0 \u003c\u003d val \u003c\u003d 255:"},{"line_number":238,"context_line":"        return val"},{"line_number":239,"context_line":"    elif data.lower() in constants.IPTABLES_VALID_PROTOCOLS:"},{"line_number":240,"context_line":"        return data.lower()"},{"line_number":241,"context_line":"    else:"},{"line_number":242,"context_line":"        error_message \u003d (\"IP protocol \u0027%s\u0027 is not supported. Only protocol \""},{"line_number":243,"context_line":"                         \"values %s and their integer representation (0 to \""}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_a5578ac8","line":240,"range":{"start_line":229,"start_character":4,"end_line":240,"end_character":27},"updated":"2016-12-16 01:59:19.000000000","message":"this could be a lot less verbose, more pythonic and not needing six if you just tried to cast and catch ValueError and AttributeError. Also try to use lower() once.","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"7ed3ea73f1b7dcd12bda3afbfab3141e52db9fb0","unresolved":false,"context_lines":[{"line_number":226,"context_line":"    names."},{"line_number":227,"context_line":"    \"\"\""},{"line_number":228,"context_line":""},{"line_number":229,"context_line":"    val \u003d None"},{"line_number":230,"context_line":"    if data is None:"},{"line_number":231,"context_line":"        return"},{"line_number":232,"context_line":"    if isinstance(data, six.text_type):"},{"line_number":233,"context_line":"        if data.isdigit():"},{"line_number":234,"context_line":"            val \u003d int(data)"},{"line_number":235,"context_line":"    if isinstance(data, six.integer_types):"},{"line_number":236,"context_line":"        val \u003d data"},{"line_number":237,"context_line":"    if val is not None and 0 \u003c\u003d val \u003c\u003d 255:"},{"line_number":238,"context_line":"        return val"},{"line_number":239,"context_line":"    elif data.lower() in constants.IPTABLES_VALID_PROTOCOLS:"},{"line_number":240,"context_line":"        return data.lower()"},{"line_number":241,"context_line":"    else:"},{"line_number":242,"context_line":"        error_message \u003d (\"IP protocol \u0027%s\u0027 is not supported. Only protocol \""},{"line_number":243,"context_line":"                         \"values %s and their integer representation (0 to \""}],"source_content_type":"text/x-python","patch_set":14,"id":"ba5201f7_d4449a75","line":240,"range":{"start_line":229,"start_character":4,"end_line":240,"end_character":27},"in_reply_to":"1a6eadb0_a5578ac8","updated":"2017-01-03 21:22:26.000000000","message":"I think I got this right.","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"4317ca1b463469f82c9aa1950ef1acd602300ef7","unresolved":false,"context_lines":[{"line_number":242,"context_line":"        error_message \u003d (\"IP protocol \u0027%s\u0027 is not supported. Only protocol \""},{"line_number":243,"context_line":"                         \"values %s and their integer representation (0 to \""},{"line_number":244,"context_line":"                         \"255) are supported\""},{"line_number":245,"context_line":"                         \".\") % (data, constants.IPTABLES_VALID_PROTOCOLS)"},{"line_number":246,"context_line":"        raise n_exc.InvalidInput(error_message\u003derror_message)"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_05dcbe71","line":245,"updated":"2016-12-16 01:59:19.000000000","message":"why the trailing period on the new line? It must feel pretty lonely, poor thing!","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":17776,"name":"Reedip","email":"reedip.banerjee@gmail.com","username":"Reedip"},"change_message_id":"e60a9d531e0eab1591363e30a40aee117f097250","unresolved":false,"context_lines":[{"line_number":242,"context_line":"        error_message \u003d (\"IP protocol \u0027%s\u0027 is not supported. Only protocol \""},{"line_number":243,"context_line":"                         \"values %s and their integer representation (0 to \""},{"line_number":244,"context_line":"                         \"255) are supported\""},{"line_number":245,"context_line":"                         \".\") % (data, constants.IPTABLES_VALID_PROTOCOLS)"},{"line_number":246,"context_line":"        raise n_exc.InvalidInput(error_message\u003derror_message)"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_9ee3b4d8","line":245,"in_reply_to":"1a6eadb0_05dcbe71","updated":"2016-12-16 07:23:37.000000000","message":"+1","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"7ed3ea73f1b7dcd12bda3afbfab3141e52db9fb0","unresolved":false,"context_lines":[{"line_number":242,"context_line":"        error_message \u003d (\"IP protocol \u0027%s\u0027 is not supported. Only protocol \""},{"line_number":243,"context_line":"                         \"values %s and their integer representation (0 to \""},{"line_number":244,"context_line":"                         \"255) are supported\""},{"line_number":245,"context_line":"                         \".\") % (data, constants.IPTABLES_VALID_PROTOCOLS)"},{"line_number":246,"context_line":"        raise n_exc.InvalidInput(error_message\u003derror_message)"}],"source_content_type":"text/x-python","patch_set":14,"id":"ba5201f7_83c01e2c","line":245,"in_reply_to":"1a6eadb0_05dcbe71","updated":"2017-01-03 21:22:26.000000000","message":"pep8 compliance tomfoolery.  It looks much better now.","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"87ee62a92e458721a9aa4d2d1773664c39e98800","unresolved":false,"context_lines":[{"line_number":202,"context_line":"        raise n_exc.InvalidInput(error_message\u003derror_message)"},{"line_number":203,"context_line":""},{"line_number":204,"context_line":""},{"line_number":205,"context_line":"def convert_protocol(data):"},{"line_number":206,"context_line":"    \"\"\"Validate that a specified IP protocol is valid."},{"line_number":207,"context_line":""},{"line_number":208,"context_line":"    For the authoritative list mapping protocol names to numbers, see the IANA:"}],"source_content_type":"text/x-python","patch_set":18,"id":"ba5201f7_ea351dda","line":205,"range":{"start_line":205,"start_character":4,"end_line":205,"end_character":20},"updated":"2017-01-04 13:51:27.000000000","message":"Nit: The converter naming convention seems to be::\n\n   convert_\u003cinput_type\u003e_to_\u003coutput_type\u003e\n\n\nWith that in mind, I\u0027d probably opt to call this something like convert_to_protocol","commit_id":"ca4f887d2a753ccbd7e2f516fe9619173d7a192f"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"353ad7d57790295f50d90853b48bef6f2db0bbb0","unresolved":false,"context_lines":[{"line_number":202,"context_line":"        raise n_exc.InvalidInput(error_message\u003derror_message)"},{"line_number":203,"context_line":""},{"line_number":204,"context_line":""},{"line_number":205,"context_line":"def convert_protocol(data):"},{"line_number":206,"context_line":"    \"\"\"Validate that a specified IP protocol is valid."},{"line_number":207,"context_line":""},{"line_number":208,"context_line":"    For the authoritative list mapping protocol names to numbers, see the IANA:"}],"source_content_type":"text/x-python","patch_set":18,"id":"ba5201f7_713f59d6","line":205,"range":{"start_line":205,"start_character":4,"end_line":205,"end_character":20},"in_reply_to":"ba5201f7_ea351dda","updated":"2017-01-05 15:27:23.000000000","message":"Done","commit_id":"ca4f887d2a753ccbd7e2f516fe9619173d7a192f"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"c6d7d62fc45989d121ca77e24f210ada16e78936","unresolved":false,"context_lines":[{"line_number":219,"context_line":""},{"line_number":220,"context_line":"    if data is None:"},{"line_number":221,"context_line":"        return"},{"line_number":222,"context_line":"    val \u003d data.lower()"},{"line_number":223,"context_line":"    if val in constants.IPTABLES_PROTOCOL_MAP:"},{"line_number":224,"context_line":"        return data"},{"line_number":225,"context_line":"    error_message \u003d (\"IP protocol \u0027%s\u0027 is not supported. Only protocol \""}],"source_content_type":"text/x-python","patch_set":18,"id":"ba5201f7_50dedd11","line":222,"updated":"2017-01-04 11:38:04.000000000","message":"what if data is not a string?","commit_id":"ca4f887d2a753ccbd7e2f516fe9619173d7a192f"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"87ee62a92e458721a9aa4d2d1773664c39e98800","unresolved":false,"context_lines":[{"line_number":219,"context_line":""},{"line_number":220,"context_line":"    if data is None:"},{"line_number":221,"context_line":"        return"},{"line_number":222,"context_line":"    val \u003d data.lower()"},{"line_number":223,"context_line":"    if val in constants.IPTABLES_PROTOCOL_MAP:"},{"line_number":224,"context_line":"        return data"},{"line_number":225,"context_line":"    error_message \u003d (\"IP protocol \u0027%s\u0027 is not supported. Only protocol \""}],"source_content_type":"text/x-python","patch_set":18,"id":"ba5201f7_9f3f71d5","line":222,"in_reply_to":"ba5201f7_50dedd11","updated":"2017-01-04 13:51:27.000000000","message":"Could probably just call convert_string_to_case_insensitive() to convert, no?","commit_id":"ca4f887d2a753ccbd7e2f516fe9619173d7a192f"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"353ad7d57790295f50d90853b48bef6f2db0bbb0","unresolved":false,"context_lines":[{"line_number":219,"context_line":""},{"line_number":220,"context_line":"    if data is None:"},{"line_number":221,"context_line":"        return"},{"line_number":222,"context_line":"    val \u003d data.lower()"},{"line_number":223,"context_line":"    if val in constants.IPTABLES_PROTOCOL_MAP:"},{"line_number":224,"context_line":"        return data"},{"line_number":225,"context_line":"    error_message \u003d (\"IP protocol \u0027%s\u0027 is not supported. Only protocol \""}],"source_content_type":"text/x-python","patch_set":18,"id":"ba5201f7_d1f2c5d1","line":222,"in_reply_to":"ba5201f7_9f3f71d5","updated":"2017-01-05 15:27:23.000000000","message":"Good idea, done.","commit_id":"ca4f887d2a753ccbd7e2f516fe9619173d7a192f"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"c6d7d62fc45989d121ca77e24f210ada16e78936","unresolved":false,"context_lines":[{"line_number":220,"context_line":"    if data is None:"},{"line_number":221,"context_line":"        return"},{"line_number":222,"context_line":"    val \u003d data.lower()"},{"line_number":223,"context_line":"    if val in constants.IPTABLES_PROTOCOL_MAP:"},{"line_number":224,"context_line":"        return data"},{"line_number":225,"context_line":"    error_message \u003d (\"IP protocol \u0027%s\u0027 is not supported. Only protocol \""},{"line_number":226,"context_line":"                     \"names and their integer representation (0 to \""}],"source_content_type":"text/x-python","patch_set":18,"id":"ba5201f7_30e239a0","line":223,"range":{"start_line":223,"start_character":24,"end_line":223,"end_character":45},"updated":"2017-01-04 11:38:04.000000000","message":"val is actually the key of the map, so using val is a bit of a misnomer as val in map is mean to see whether a key is in the dictionary. Besides you never use IPTABLES_PROTOCOL_MAP\u0027s values, so am I am still struggling to see the need.","commit_id":"ca4f887d2a753ccbd7e2f516fe9619173d7a192f"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"353ad7d57790295f50d90853b48bef6f2db0bbb0","unresolved":false,"context_lines":[{"line_number":220,"context_line":"    if data is None:"},{"line_number":221,"context_line":"        return"},{"line_number":222,"context_line":"    val \u003d data.lower()"},{"line_number":223,"context_line":"    if val in constants.IPTABLES_PROTOCOL_MAP:"},{"line_number":224,"context_line":"        return data"},{"line_number":225,"context_line":"    error_message \u003d (\"IP protocol \u0027%s\u0027 is not supported. Only protocol \""},{"line_number":226,"context_line":"                     \"names and their integer representation (0 to \""}],"source_content_type":"text/x-python","patch_set":18,"id":"ba5201f7_71483988","line":223,"range":{"start_line":223,"start_character":24,"end_line":223,"end_character":45},"in_reply_to":"ba5201f7_30e239a0","updated":"2017-01-05 15:27:23.000000000","message":"The same dict is defined in neutron-fwaas (as \u0027protocol_modules\u0027) and in neutron (see https://review.openstack.org/#/c/390592/3/neutron/common/constants.py@68 for example) for security groups.  So while neutron and neutron-fwaas duplicate the dict, neutron-lib needs at least the keys for the validation.  I figured it is ripe for consolidation into a single entity.","commit_id":"ca4f887d2a753ccbd7e2f516fe9619173d7a192f"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"87ee62a92e458721a9aa4d2d1773664c39e98800","unresolved":false,"context_lines":[{"line_number":230,"context_line":"            return data"},{"line_number":231,"context_line":"        else:"},{"line_number":232,"context_line":"            raise n_exc.InvalidInput(error_message\u003derror_message)"},{"line_number":233,"context_line":"    except n_exc.InvalidInput:"},{"line_number":234,"context_line":"        raise n_exc.InvalidInput(error_message\u003derror_message)"}],"source_content_type":"text/x-python","patch_set":18,"id":"ba5201f7_5f4ee996","line":233,"updated":"2017-01-04 13:51:27.000000000","message":"I\u0027m probably missing something obvious, but where does InvalidInput get raised? I\u0027m not seeing it raised in validate_range().","commit_id":"ca4f887d2a753ccbd7e2f516fe9619173d7a192f"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"353ad7d57790295f50d90853b48bef6f2db0bbb0","unresolved":false,"context_lines":[{"line_number":230,"context_line":"            return data"},{"line_number":231,"context_line":"        else:"},{"line_number":232,"context_line":"            raise n_exc.InvalidInput(error_message\u003derror_message)"},{"line_number":233,"context_line":"    except n_exc.InvalidInput:"},{"line_number":234,"context_line":"        raise n_exc.InvalidInput(error_message\u003derror_message)"}],"source_content_type":"text/x-python","patch_set":18,"id":"ba5201f7_f1c42960","line":233,"in_reply_to":"ba5201f7_5f4ee996","updated":"2017-01-05 15:27:23.000000000","message":"It comes from convert_to_int().","commit_id":"ca4f887d2a753ccbd7e2f516fe9619173d7a192f"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"0bebd29f69cd9d77ebf168be1ff01d798f1e80da","unresolved":false,"context_lines":[{"line_number":198,"context_line":"    try:"},{"line_number":199,"context_line":"        return data.lower()"},{"line_number":200,"context_line":"    except AttributeError:"},{"line_number":201,"context_line":"        error_message \u003d (\"Input value %s must be string type\") % data"},{"line_number":202,"context_line":"        raise n_exc.InvalidInput(error_message\u003derror_message)"},{"line_number":203,"context_line":""},{"line_number":204,"context_line":""}],"source_content_type":"text/x-python","patch_set":22,"id":"ba5201f7_497a3bbe","line":201,"updated":"2017-01-08 11:37:18.000000000","message":"missing translation _()","commit_id":"136fb595e439d6ca3756c55786823967cd5c57ad"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"27ff6f63b685a38c935f710c5b6c45612a175bb3","unresolved":false,"context_lines":[{"line_number":198,"context_line":"    try:"},{"line_number":199,"context_line":"        return data.lower()"},{"line_number":200,"context_line":"    except AttributeError:"},{"line_number":201,"context_line":"        error_message \u003d (\"Input value %s must be string type\") % data"},{"line_number":202,"context_line":"        raise n_exc.InvalidInput(error_message\u003derror_message)"},{"line_number":203,"context_line":""},{"line_number":204,"context_line":""}],"source_content_type":"text/x-python","patch_set":22,"id":"ba5201f7_e22928f4","line":201,"in_reply_to":"ba5201f7_497a3bbe","updated":"2017-01-09 15:34:52.000000000","message":"Done","commit_id":"136fb595e439d6ca3756c55786823967cd5c57ad"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"0bebd29f69cd9d77ebf168be1ff01d798f1e80da","unresolved":false,"context_lines":[{"line_number":223,"context_line":"    if val in constants.IPTABLES_PROTOCOL_MAP:"},{"line_number":224,"context_line":"        return data"},{"line_number":225,"context_line":""},{"line_number":226,"context_line":"    error_message \u003d (\"IP protocol \u0027%s\u0027 is not supported. Only protocol \""},{"line_number":227,"context_line":"                     \"names and their integer representation (0 to \""},{"line_number":228,"context_line":"                     \"255) are supported\") % data"},{"line_number":229,"context_line":"    try:"}],"source_content_type":"text/x-python","patch_set":22,"id":"ba5201f7_8980a38c","line":226,"updated":"2017-01-08 11:37:18.000000000","message":"ditto","commit_id":"136fb595e439d6ca3756c55786823967cd5c57ad"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"27ff6f63b685a38c935f710c5b6c45612a175bb3","unresolved":false,"context_lines":[{"line_number":223,"context_line":"    if val in constants.IPTABLES_PROTOCOL_MAP:"},{"line_number":224,"context_line":"        return data"},{"line_number":225,"context_line":""},{"line_number":226,"context_line":"    error_message \u003d (\"IP protocol \u0027%s\u0027 is not supported. Only protocol \""},{"line_number":227,"context_line":"                     \"names and their integer representation (0 to \""},{"line_number":228,"context_line":"                     \"255) are supported\") % data"},{"line_number":229,"context_line":"    try:"}],"source_content_type":"text/x-python","patch_set":22,"id":"ba5201f7_22341049","line":226,"in_reply_to":"ba5201f7_8980a38c","updated":"2017-01-09 15:34:52.000000000","message":"Done","commit_id":"136fb595e439d6ca3756c55786823967cd5c57ad"}],"neutron_lib/api/validators.py":[{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"3916d02afec9b1a89ef78fbf275b33d0c2618a1f","unresolved":false,"context_lines":[{"line_number":842,"context_line":"    \"\"\"Validate data is a range of TCP/UDP port numbers"},{"line_number":843,"context_line":""},{"line_number":844,"context_line":"    :param data: The data to validate"},{"line_number":845,"context_line":"    :param valid_values: Not used!"},{"line_number":846,"context_line":"    :returns: None if data is an int between 0 and 65535, or two ints between 0"},{"line_number":847,"context_line":"    and 65535 with a colon between them, otherwise a human readable message as"},{"line_number":848,"context_line":"    to why data is invalid."}],"source_content_type":"text/x-python","patch_set":10,"id":"1a6eadb0_93de730f","line":845,"range":{"start_line":845,"start_character":5,"end_line":845,"end_character":34},"updated":"2016-12-15 13:38:38.000000000","message":"I know that we\u0027ve set a less than optimal precedence in these validators by ignoring valid_values, but I\u0027d prefer we go ahead and support valid_values for new functions. Seems like in this case valid_values could contain a list of int (ports) that are allowable for data.","commit_id":"9d2e858cd122568903a6cdcd47f941b9746bd9f5"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"3916d02afec9b1a89ef78fbf275b33d0c2618a1f","unresolved":false,"context_lines":[{"line_number":850,"context_line":"    if data is None:"},{"line_number":851,"context_line":"        return"},{"line_number":852,"context_line":"    data \u003d str(data)"},{"line_number":853,"context_line":"    ports \u003d data.split(\u0027:\u0027)"},{"line_number":854,"context_line":"    for p in ports:"},{"line_number":855,"context_line":"        try:"},{"line_number":856,"context_line":"            val \u003d int(p)"}],"source_content_type":"text/x-python","patch_set":10,"id":"1a6eadb0_d3554bc2","line":853,"updated":"2016-12-15 13:38:38.000000000","message":"What if data has multiple colons? e.g. 1024:2048:4096","commit_id":"9d2e858cd122568903a6cdcd47f941b9746bd9f5"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"ccff6267c77f8514b7ebbc3497039696a0e65e54","unresolved":false,"context_lines":[{"line_number":850,"context_line":"    if data is None:"},{"line_number":851,"context_line":"        return"},{"line_number":852,"context_line":"    data \u003d str(data)"},{"line_number":853,"context_line":"    ports \u003d data.split(\u0027:\u0027)"},{"line_number":854,"context_line":"    for p in ports:"},{"line_number":855,"context_line":"        try:"},{"line_number":856,"context_line":"            val \u003d int(p)"}],"source_content_type":"text/x-python","patch_set":10,"id":"1a6eadb0_ed909b45","line":853,"in_reply_to":"1a6eadb0_d3554bc2","updated":"2016-12-15 17:42:17.000000000","message":"Good point, I\u0027ll do a len(ports) check.","commit_id":"9d2e858cd122568903a6cdcd47f941b9746bd9f5"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"3916d02afec9b1a89ef78fbf275b33d0c2618a1f","unresolved":false,"context_lines":[{"line_number":853,"context_line":"    ports \u003d data.split(\u0027:\u0027)"},{"line_number":854,"context_line":"    for p in ports:"},{"line_number":855,"context_line":"        try:"},{"line_number":856,"context_line":"            val \u003d int(p)"},{"line_number":857,"context_line":"        except (ValueError, TypeError):"},{"line_number":858,"context_line":"            msg \u003d _(\"Port \u0027%s\u0027 is not a valid number\") % p"},{"line_number":859,"context_line":"            LOG.debug(msg)"}],"source_content_type":"text/x-python","patch_set":10,"id":"1a6eadb0_b3c0cf51","line":856,"range":{"start_line":856,"start_character":12,"end_line":856,"end_character":24},"updated":"2016-12-15 13:38:38.000000000","message":"Hypothetically it seems we could use converters.convert_to_int() here, tho I\u0027m not sure what it buys us.","commit_id":"9d2e858cd122568903a6cdcd47f941b9746bd9f5"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"ccff6267c77f8514b7ebbc3497039696a0e65e54","unresolved":false,"context_lines":[{"line_number":853,"context_line":"    ports \u003d data.split(\u0027:\u0027)"},{"line_number":854,"context_line":"    for p in ports:"},{"line_number":855,"context_line":"        try:"},{"line_number":856,"context_line":"            val \u003d int(p)"},{"line_number":857,"context_line":"        except (ValueError, TypeError):"},{"line_number":858,"context_line":"            msg \u003d _(\"Port \u0027%s\u0027 is not a valid number\") % p"},{"line_number":859,"context_line":"            LOG.debug(msg)"}],"source_content_type":"text/x-python","patch_set":10,"id":"1a6eadb0_e8832954","line":856,"range":{"start_line":856,"start_character":12,"end_line":856,"end_character":24},"in_reply_to":"1a6eadb0_b3c0cf51","updated":"2016-12-15 17:42:17.000000000","message":"Gave it a go.  Dogfood.","commit_id":"9d2e858cd122568903a6cdcd47f941b9746bd9f5"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"3916d02afec9b1a89ef78fbf275b33d0c2618a1f","unresolved":false,"context_lines":[{"line_number":858,"context_line":"            msg \u003d _(\"Port \u0027%s\u0027 is not a valid number\") % p"},{"line_number":859,"context_line":"            LOG.debug(msg)"},{"line_number":860,"context_line":"            return msg"},{"line_number":861,"context_line":"        if val \u003c\u003d 0 or val \u003e 65535:"},{"line_number":862,"context_line":"            msg \u003d _(\"Invalid port \u0027%s\u0027\") % p"},{"line_number":863,"context_line":"            LOG.debug(msg)"},{"line_number":864,"context_line":"            return msg"}],"source_content_type":"text/x-python","patch_set":10,"id":"1a6eadb0_73fe37af","line":861,"range":{"start_line":861,"start_character":8,"end_line":861,"end_character":35},"updated":"2016-12-15 13:38:38.000000000","message":"Why not use the validate_range() validator here?","commit_id":"9d2e858cd122568903a6cdcd47f941b9746bd9f5"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"ccff6267c77f8514b7ebbc3497039696a0e65e54","unresolved":false,"context_lines":[{"line_number":858,"context_line":"            msg \u003d _(\"Port \u0027%s\u0027 is not a valid number\") % p"},{"line_number":859,"context_line":"            LOG.debug(msg)"},{"line_number":860,"context_line":"            return msg"},{"line_number":861,"context_line":"        if val \u003c\u003d 0 or val \u003e 65535:"},{"line_number":862,"context_line":"            msg \u003d _(\"Invalid port \u0027%s\u0027\") % p"},{"line_number":863,"context_line":"            LOG.debug(msg)"},{"line_number":864,"context_line":"            return msg"}],"source_content_type":"text/x-python","patch_set":10,"id":"1a6eadb0_4d150f47","line":861,"range":{"start_line":861,"start_character":8,"end_line":861,"end_character":35},"in_reply_to":"1a6eadb0_73fe37af","updated":"2016-12-15 17:42:17.000000000","message":"Good idea!","commit_id":"9d2e858cd122568903a6cdcd47f941b9746bd9f5"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"4317ca1b463469f82c9aa1950ef1acd602300ef7","unresolved":false,"context_lines":[{"line_number":838,"context_line":"        return msg"},{"line_number":839,"context_line":""},{"line_number":840,"context_line":""},{"line_number":841,"context_line":"def validate_port_range(data, valid_values\u003dNone):"},{"line_number":842,"context_line":"    \"\"\"Validate data is a range of TCP/UDP port numbers"},{"line_number":843,"context_line":""},{"line_number":844,"context_line":"    :param data: The data to validate"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_c5e9e6b8","line":841,"updated":"2016-12-16 01:59:19.000000000","message":"I think the verbosity of this validator can be simplified a bit.","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"4317ca1b463469f82c9aa1950ef1acd602300ef7","unresolved":false,"context_lines":[{"line_number":849,"context_line":"    \"\"\""},{"line_number":850,"context_line":"    if data is None:"},{"line_number":851,"context_line":"        return"},{"line_number":852,"context_line":"    data \u003d str(data)"},{"line_number":853,"context_line":"    ports \u003d data.split(\u0027:\u0027)"},{"line_number":854,"context_line":"    if len(ports) \u003e 2:"},{"line_number":855,"context_line":"        msg \u003d _(\"Port range must be two integers separated by a colon.\")"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_c5b646f8","line":852,"updated":"2016-12-16 01:59:19.000000000","message":"no need to turn data into a string, if it\u0027s already a string. An AttributeError could be caught to handle the degenerate case.","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"7ed3ea73f1b7dcd12bda3afbfab3141e52db9fb0","unresolved":false,"context_lines":[{"line_number":849,"context_line":"    \"\"\""},{"line_number":850,"context_line":"    if data is None:"},{"line_number":851,"context_line":"        return"},{"line_number":852,"context_line":"    data \u003d str(data)"},{"line_number":853,"context_line":"    ports \u003d data.split(\u0027:\u0027)"},{"line_number":854,"context_line":"    if len(ports) \u003e 2:"},{"line_number":855,"context_line":"        msg \u003d _(\"Port range must be two integers separated by a colon.\")"}],"source_content_type":"text/x-python","patch_set":14,"id":"ba5201f7_7db5992f","line":852,"in_reply_to":"1a6eadb0_c5b646f8","updated":"2017-01-03 21:22:26.000000000","message":"Done","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"4317ca1b463469f82c9aa1950ef1acd602300ef7","unresolved":false,"context_lines":[{"line_number":855,"context_line":"        msg \u003d _(\"Port range must be two integers separated by a colon.\")"},{"line_number":856,"context_line":"        LOG.debug(msg)"},{"line_number":857,"context_line":"        return msg"},{"line_number":858,"context_line":"    for p in ports:"},{"line_number":859,"context_line":"        try:"},{"line_number":860,"context_line":"            val \u003d converters.convert_to_int(p)"},{"line_number":861,"context_line":"        except n_exc.InvalidInput as e:"},{"line_number":862,"context_line":"            LOG.debug(str(e))"},{"line_number":863,"context_line":"            return str(e)"},{"line_number":864,"context_line":"        valid_ip_port_range \u003d [0, 65535]"},{"line_number":865,"context_line":"        range_validation \u003d validate_range(val, valid_ip_port_range)"},{"line_number":866,"context_line":"        if range_validation is not None:"},{"line_number":867,"context_line":"            msg \u003d _(\"Invalid port: %s\") % range_validation"},{"line_number":868,"context_line":"            LOG.debug(msg)"},{"line_number":869,"context_line":"            return msg"},{"line_number":870,"context_line":""},{"line_number":871,"context_line":""},{"line_number":872,"context_line":"def validate_subports(data, valid_values\u003dNone):"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_85e36ed8","line":869,"range":{"start_line":858,"start_character":4,"end_line":869,"end_character":22},"updated":"2016-12-16 01:59:19.000000000","message":"have you looked at [1], perhaps we can apply a bit of divide et impera and make this a bit smaller.\n\n[1] https://github.com/openstack/neutron/blob/master/neutron/extensions/securitygroup.py#L177","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"7ed3ea73f1b7dcd12bda3afbfab3141e52db9fb0","unresolved":false,"context_lines":[{"line_number":855,"context_line":"        msg \u003d _(\"Port range must be two integers separated by a colon.\")"},{"line_number":856,"context_line":"        LOG.debug(msg)"},{"line_number":857,"context_line":"        return msg"},{"line_number":858,"context_line":"    for p in ports:"},{"line_number":859,"context_line":"        try:"},{"line_number":860,"context_line":"            val \u003d converters.convert_to_int(p)"},{"line_number":861,"context_line":"        except n_exc.InvalidInput as e:"},{"line_number":862,"context_line":"            LOG.debug(str(e))"},{"line_number":863,"context_line":"            return str(e)"},{"line_number":864,"context_line":"        valid_ip_port_range \u003d [0, 65535]"},{"line_number":865,"context_line":"        range_validation \u003d validate_range(val, valid_ip_port_range)"},{"line_number":866,"context_line":"        if range_validation is not None:"},{"line_number":867,"context_line":"            msg \u003d _(\"Invalid port: %s\") % range_validation"},{"line_number":868,"context_line":"            LOG.debug(msg)"},{"line_number":869,"context_line":"            return msg"},{"line_number":870,"context_line":""},{"line_number":871,"context_line":""},{"line_number":872,"context_line":"def validate_subports(data, valid_values\u003dNone):"}],"source_content_type":"text/x-python","patch_set":14,"id":"ba5201f7_200da83e","line":869,"range":{"start_line":858,"start_character":4,"end_line":869,"end_character":22},"in_reply_to":"1a6eadb0_85e36ed8","updated":"2017-01-03 21:22:26.000000000","message":"I think I was able to take a sound approach to shrink this and make it more elegant based on your pointer.  Thanks!","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":17776,"name":"Reedip","email":"reedip.banerjee@gmail.com","username":"Reedip"},"change_message_id":"e60a9d531e0eab1591363e30a40aee117f097250","unresolved":false,"context_lines":[{"line_number":855,"context_line":"        msg \u003d _(\"Port range must be two integers separated by a colon.\")"},{"line_number":856,"context_line":"        LOG.debug(msg)"},{"line_number":857,"context_line":"        return msg"},{"line_number":858,"context_line":"    for p in ports:"},{"line_number":859,"context_line":"        try:"},{"line_number":860,"context_line":"            val \u003d converters.convert_to_int(p)"},{"line_number":861,"context_line":"        except n_exc.InvalidInput as e:"},{"line_number":862,"context_line":"            LOG.debug(str(e))"},{"line_number":863,"context_line":"            return str(e)"},{"line_number":864,"context_line":"        valid_ip_port_range \u003d [0, 65535]"},{"line_number":865,"context_line":"        range_validation \u003d validate_range(val, valid_ip_port_range)"},{"line_number":866,"context_line":"        if range_validation is not None:"},{"line_number":867,"context_line":"            msg \u003d _(\"Invalid port: %s\") % range_validation"},{"line_number":868,"context_line":"            LOG.debug(msg)"},{"line_number":869,"context_line":"            return msg"},{"line_number":870,"context_line":""},{"line_number":871,"context_line":""},{"line_number":872,"context_line":"def validate_subports(data, valid_values\u003dNone):"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_be34f049","line":869,"range":{"start_line":858,"start_character":4,"end_line":869,"end_character":22},"in_reply_to":"1a6eadb0_85e36ed8","updated":"2016-12-16 07:23:37.000000000","message":"Learnt something new \"divide et impera\"","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"87ee62a92e458721a9aa4d2d1773664c39e98800","unresolved":false,"context_lines":[{"line_number":848,"context_line":"    and 65535 with a colon between them, otherwise a human readable message as"},{"line_number":849,"context_line":"    to why data is invalid."},{"line_number":850,"context_line":"    \"\"\""},{"line_number":851,"context_line":"    if data is None:"},{"line_number":852,"context_line":"        return"},{"line_number":853,"context_line":"    try:"},{"line_number":854,"context_line":"        ports \u003d data.split(\u0027:\u0027)"}],"source_content_type":"text/x-python","patch_set":18,"id":"ba5201f7_2a5f25e6","line":851,"updated":"2017-01-04 13:51:27.000000000","message":"Since None is an acceptable value, shouldn\u0027t we name this function something like validate_port_range_or_none() to follow naming conventions in validators?","commit_id":"ca4f887d2a753ccbd7e2f516fe9619173d7a192f"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"353ad7d57790295f50d90853b48bef6f2db0bbb0","unresolved":false,"context_lines":[{"line_number":848,"context_line":"    and 65535 with a colon between them, otherwise a human readable message as"},{"line_number":849,"context_line":"    to why data is invalid."},{"line_number":850,"context_line":"    \"\"\""},{"line_number":851,"context_line":"    if data is None:"},{"line_number":852,"context_line":"        return"},{"line_number":853,"context_line":"    try:"},{"line_number":854,"context_line":"        ports \u003d data.split(\u0027:\u0027)"}],"source_content_type":"text/x-python","patch_set":18,"id":"ba5201f7_cc35ceda","line":851,"in_reply_to":"ba5201f7_2a5f25e6","updated":"2017-01-05 15:27:23.000000000","message":"Done","commit_id":"ca4f887d2a753ccbd7e2f516fe9619173d7a192f"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"87ee62a92e458721a9aa4d2d1773664c39e98800","unresolved":false,"context_lines":[{"line_number":850,"context_line":"    \"\"\""},{"line_number":851,"context_line":"    if data is None:"},{"line_number":852,"context_line":"        return"},{"line_number":853,"context_line":"    try:"},{"line_number":854,"context_line":"        ports \u003d data.split(\u0027:\u0027)"},{"line_number":855,"context_line":"    except AttributeError:"},{"line_number":856,"context_line":"        msg \u003d _(\"Port range must be a string.\")"},{"line_number":857,"context_line":"        LOG.debug(msg)"},{"line_number":858,"context_line":"        return msg"},{"line_number":859,"context_line":""},{"line_number":860,"context_line":"    if len(ports) \u003e 2:"},{"line_number":861,"context_line":"        msg \u003d _(\"Port range must be two integers separated by a colon.\")"}],"source_content_type":"text/x-python","patch_set":18,"id":"ba5201f7_eaa0bda1","line":858,"range":{"start_line":853,"start_character":0,"end_line":858,"end_character":18},"updated":"2017-01-04 13:51:27.000000000","message":"Rather than the above, another option might be to just call validate_string_or_none(); success indicates its a string and split() could be called without a try block.","commit_id":"ca4f887d2a753ccbd7e2f516fe9619173d7a192f"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"353ad7d57790295f50d90853b48bef6f2db0bbb0","unresolved":false,"context_lines":[{"line_number":850,"context_line":"    \"\"\""},{"line_number":851,"context_line":"    if data is None:"},{"line_number":852,"context_line":"        return"},{"line_number":853,"context_line":"    try:"},{"line_number":854,"context_line":"        ports \u003d data.split(\u0027:\u0027)"},{"line_number":855,"context_line":"    except AttributeError:"},{"line_number":856,"context_line":"        msg \u003d _(\"Port range must be a string.\")"},{"line_number":857,"context_line":"        LOG.debug(msg)"},{"line_number":858,"context_line":"        return msg"},{"line_number":859,"context_line":""},{"line_number":860,"context_line":"    if len(ports) \u003e 2:"},{"line_number":861,"context_line":"        msg \u003d _(\"Port range must be two integers separated by a colon.\")"}],"source_content_type":"text/x-python","patch_set":18,"id":"ba5201f7_005eb611","line":858,"range":{"start_line":853,"start_character":0,"end_line":858,"end_character":18},"in_reply_to":"ba5201f7_eaa0bda1","updated":"2017-01-05 15:27:23.000000000","message":"Done","commit_id":"ca4f887d2a753ccbd7e2f516fe9619173d7a192f"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"c6d7d62fc45989d121ca77e24f210ada16e78936","unresolved":false,"context_lines":[{"line_number":863,"context_line":"        return msg"},{"line_number":864,"context_line":"    for p in ports:"},{"line_number":865,"context_line":"        if not netutils.is_valid_port(p):"},{"line_number":866,"context_line":"            msg \u003d _(\"Invalid port: %s\") % p"},{"line_number":867,"context_line":"            LOG.debug(msg)"},{"line_number":868,"context_line":"            return msg"},{"line_number":869,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"ba5201f7_d0a48da7","line":866,"updated":"2017-01-04 11:38:04.000000000","message":"forgot the trailing period.","commit_id":"ca4f887d2a753ccbd7e2f516fe9619173d7a192f"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"353ad7d57790295f50d90853b48bef6f2db0bbb0","unresolved":false,"context_lines":[{"line_number":863,"context_line":"        return msg"},{"line_number":864,"context_line":"    for p in ports:"},{"line_number":865,"context_line":"        if not netutils.is_valid_port(p):"},{"line_number":866,"context_line":"            msg \u003d _(\"Invalid port: %s\") % p"},{"line_number":867,"context_line":"            LOG.debug(msg)"},{"line_number":868,"context_line":"            return msg"},{"line_number":869,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"ba5201f7_e049b261","line":866,"in_reply_to":"ba5201f7_2a13a5b9","updated":"2017-01-05 15:27:23.000000000","message":"Done","commit_id":"ca4f887d2a753ccbd7e2f516fe9619173d7a192f"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"353ad7d57790295f50d90853b48bef6f2db0bbb0","unresolved":false,"context_lines":[{"line_number":863,"context_line":"        return msg"},{"line_number":864,"context_line":"    for p in ports:"},{"line_number":865,"context_line":"        if not netutils.is_valid_port(p):"},{"line_number":866,"context_line":"            msg \u003d _(\"Invalid port: %s\") % p"},{"line_number":867,"context_line":"            LOG.debug(msg)"},{"line_number":868,"context_line":"            return msg"},{"line_number":869,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"ba5201f7_0047964b","line":866,"in_reply_to":"ba5201f7_d0a48da7","updated":"2017-01-05 15:27:23.000000000","message":"Done","commit_id":"ca4f887d2a753ccbd7e2f516fe9619173d7a192f"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"87ee62a92e458721a9aa4d2d1773664c39e98800","unresolved":false,"context_lines":[{"line_number":863,"context_line":"        return msg"},{"line_number":864,"context_line":"    for p in ports:"},{"line_number":865,"context_line":"        if not netutils.is_valid_port(p):"},{"line_number":866,"context_line":"            msg \u003d _(\"Invalid port: %s\") % p"},{"line_number":867,"context_line":"            LOG.debug(msg)"},{"line_number":868,"context_line":"            return msg"},{"line_number":869,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"ba5201f7_2a13a5b9","line":866,"in_reply_to":"ba5201f7_d0a48da7","updated":"2017-01-04 13:51:27.000000000","message":"Nit: if an empty port is given, this message is a little confusing.\n\nEX::\n\n   validate_port_range(\u00271992:\u0027)\n\n\nWill return::\n\n    Invalid port:","commit_id":"ca4f887d2a753ccbd7e2f516fe9619173d7a192f"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"7f3e69162699dd42ec671b54c8c8e072a76fca0a","unresolved":false,"context_lines":[{"line_number":855,"context_line":"        LOG.debug(msg)"},{"line_number":856,"context_line":"        return msg"},{"line_number":857,"context_line":"    ports \u003d data.split(\u0027:\u0027)"},{"line_number":858,"context_line":"    if len(ports) \u003e 2:"},{"line_number":859,"context_line":"        msg \u003d _(\"Port range must be two integers separated by a colon.\")"},{"line_number":860,"context_line":"        LOG.debug(msg)"},{"line_number":861,"context_line":"        return msg"}],"source_content_type":"text/x-python","patch_set":20,"id":"ba5201f7_a8ef6485","line":858,"updated":"2017-01-05 18:16:53.000000000","message":"Question: with the current logic there\u0027s no ordering constraints if a range is given. For example 800:1 is a valid range. Do we need to ensure for the port range X:Y that X\u003cY ??","commit_id":"b4f762049fa4977518e7adab1cb4608de9fa4b69"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"b2650d4c54e16b973a218b86bd16ed7dd04f474e","unresolved":false,"context_lines":[{"line_number":855,"context_line":"        LOG.debug(msg)"},{"line_number":856,"context_line":"        return msg"},{"line_number":857,"context_line":"    ports \u003d data.split(\u0027:\u0027)"},{"line_number":858,"context_line":"    if len(ports) \u003e 2:"},{"line_number":859,"context_line":"        msg \u003d _(\"Port range must be two integers separated by a colon.\")"},{"line_number":860,"context_line":"        LOG.debug(msg)"},{"line_number":861,"context_line":"        return msg"}],"source_content_type":"text/x-python","patch_set":20,"id":"ba5201f7_93462c79","line":858,"in_reply_to":"ba5201f7_a8ef6485","updated":"2017-01-06 16:38:13.000000000","message":"Done","commit_id":"b4f762049fa4977518e7adab1cb4608de9fa4b69"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"25110f07020ab1935f707ac62d309b8cb49ababd","unresolved":false,"context_lines":[{"line_number":868,"context_line":"            msg \u003d _(\"Invalid port: %s.\") % p"},{"line_number":869,"context_line":"            LOG.debug(msg)"},{"line_number":870,"context_line":"            return msg"},{"line_number":871,"context_line":"    if len(ports) \u003e 1 and ports[0] \u003e ports[1]:"},{"line_number":872,"context_line":"        msg \u003d _(\"First port in a port range must be lower than the second \""},{"line_number":873,"context_line":"                \"port.\")"},{"line_number":874,"context_line":"        LOG.debug(msg)"}],"source_content_type":"text/x-python","patch_set":24,"id":"ba5201f7_317cdfb4","line":871,"updated":"2017-01-11 18:26:38.000000000","message":"What do you think about adding a test for this block? It\u0027s not covered as per: http://logs.openstack.org/43/409343/24/check/neutron-lib-coverage-ubuntu-xenial/4abce2d/cover/neutron_lib_api_validators_py.html","commit_id":"cd6e234c7c4fa8b2f82f67641d54cb9c04fd8319"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"71521a22baa399acbc0cdf847091e27af80dd03f","unresolved":false,"context_lines":[{"line_number":868,"context_line":"            msg \u003d _(\"Invalid port: %s.\") % p"},{"line_number":869,"context_line":"            LOG.debug(msg)"},{"line_number":870,"context_line":"            return msg"},{"line_number":871,"context_line":"    if len(ports) \u003e 1 and ports[0] \u003e ports[1]:"},{"line_number":872,"context_line":"        msg \u003d _(\"First port in a port range must be lower than the second \""},{"line_number":873,"context_line":"                \"port.\")"},{"line_number":874,"context_line":"        LOG.debug(msg)"}],"source_content_type":"text/x-python","patch_set":24,"id":"ba5201f7_b5235857","line":871,"in_reply_to":"ba5201f7_317cdfb4","updated":"2017-01-11 19:13:11.000000000","message":"Done","commit_id":"cd6e234c7c4fa8b2f82f67641d54cb9c04fd8319"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"c8d998776ee26cbe47ce0cbd453b539ddc527acd","unresolved":false,"context_lines":[{"line_number":851,"context_line":"    if data is None:"},{"line_number":852,"context_line":"        return"},{"line_number":853,"context_line":"    if validate_string_or_none(data):"},{"line_number":854,"context_line":"        msg \u003d _(\"Port range must be a string.\")"},{"line_number":855,"context_line":"        LOG.debug(msg)"},{"line_number":856,"context_line":"        return msg"},{"line_number":857,"context_line":"    ports \u003d data.split(\u0027:\u0027)"}],"source_content_type":"text/x-python","patch_set":25,"id":"ba5201f7_728e5bd1","line":854,"updated":"2017-01-11 23:20:41.000000000","message":"I can\u0027t never recall whether we force a trailing period or not. IIRC the unwritten rule is to omit it because as the client adds it but to it\u0027s not important, frankly.","commit_id":"100bc4e294118c45d59b4f222b54afadee87e445"}],"neutron_lib/constants.py":[{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"4317ca1b463469f82c9aa1950ef1acd602300ef7","unresolved":false,"context_lines":[{"line_number":194,"context_line":"                   PROTO_NAME_UDPLITE: PROTO_NUM_UDPLITE,"},{"line_number":195,"context_line":"                   PROTO_NAME_VRRP: PROTO_NUM_VRRP}"},{"line_number":196,"context_line":""},{"line_number":197,"context_line":"IPTABLES_VALID_PROTOCOLS \u003d [PROTO_NAME_TCP,"},{"line_number":198,"context_line":"                            PROTO_NAME_UDP,"},{"line_number":199,"context_line":"                            PROTO_NAME_ICMP]"},{"line_number":200,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_45d6b6f1","line":197,"updated":"2016-12-16 01:59:19.000000000","message":"Can you elaborate why these are called out here? Perhaps you can use valid_values to match expected protocols types and avoid defining these constants altogether.","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":17776,"name":"Reedip","email":"reedip.banerjee@gmail.com","username":"Reedip"},"change_message_id":"e60a9d531e0eab1591363e30a40aee117f097250","unresolved":false,"context_lines":[{"line_number":194,"context_line":"                   PROTO_NAME_UDPLITE: PROTO_NUM_UDPLITE,"},{"line_number":195,"context_line":"                   PROTO_NAME_VRRP: PROTO_NUM_VRRP}"},{"line_number":196,"context_line":""},{"line_number":197,"context_line":"IPTABLES_VALID_PROTOCOLS \u003d [PROTO_NAME_TCP,"},{"line_number":198,"context_line":"                            PROTO_NAME_UDP,"},{"line_number":199,"context_line":"                            PROTO_NAME_ICMP]"},{"line_number":200,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"1a6eadb0_de0e0c8b","line":197,"in_reply_to":"1a6eadb0_45d6b6f1","updated":"2016-12-16 07:23:37.000000000","message":"besides, this seems to be more FWaaS focused, because we already have a list of the Protocols defined above","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"7ed3ea73f1b7dcd12bda3afbfab3141e52db9fb0","unresolved":false,"context_lines":[{"line_number":194,"context_line":"                   PROTO_NAME_UDPLITE: PROTO_NUM_UDPLITE,"},{"line_number":195,"context_line":"                   PROTO_NAME_VRRP: PROTO_NUM_VRRP}"},{"line_number":196,"context_line":""},{"line_number":197,"context_line":"IPTABLES_VALID_PROTOCOLS \u003d [PROTO_NAME_TCP,"},{"line_number":198,"context_line":"                            PROTO_NAME_UDP,"},{"line_number":199,"context_line":"                            PROTO_NAME_ICMP]"},{"line_number":200,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"ba5201f7_e3200a9e","line":197,"in_reply_to":"1a6eadb0_de0e0c8b","updated":"2017-01-03 21:22:26.000000000","message":"Yes, I\u0027ll just use IP_PROTOCOL_MAP instead.","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"87ee62a92e458721a9aa4d2d1773664c39e98800","unresolved":false,"context_lines":[{"line_number":201,"context_line":"#"},{"line_number":202,"context_line":"# Note that this differs from IP_PROTOCOL_MAP because iptables refers to IPv6"},{"line_number":203,"context_line":"# ICMP as \u0027icmp6\u0027 whereas it is \u0027ipv6-icmp\u0027 in IP_PROTOCOL_MAP."},{"line_number":204,"context_line":"IPTABLES_PROTOCOL_MAP \u003d {PROTO_NAME_DCCP: \u0027dccp\u0027,"},{"line_number":205,"context_line":"                         PROTO_NAME_ICMP: \u0027icmp\u0027,"},{"line_number":206,"context_line":"                         PROTO_NAME_IPV6_ICMP: \u0027icmp6\u0027,"},{"line_number":207,"context_line":"                         PROTO_NAME_SCTP: \u0027sctp\u0027,"}],"source_content_type":"text/x-python","patch_set":18,"id":"ba5201f7_2a61e539","line":204,"range":{"start_line":204,"start_character":0,"end_line":204,"end_character":21},"updated":"2017-01-04 13:51:27.000000000","message":"As Armando mentioned; this isn\u0027t used anywhere so its not clear why we need it in neutron-lib.","commit_id":"ca4f887d2a753ccbd7e2f516fe9619173d7a192f"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"353ad7d57790295f50d90853b48bef6f2db0bbb0","unresolved":false,"context_lines":[{"line_number":201,"context_line":"#"},{"line_number":202,"context_line":"# Note that this differs from IP_PROTOCOL_MAP because iptables refers to IPv6"},{"line_number":203,"context_line":"# ICMP as \u0027icmp6\u0027 whereas it is \u0027ipv6-icmp\u0027 in IP_PROTOCOL_MAP."},{"line_number":204,"context_line":"IPTABLES_PROTOCOL_MAP \u003d {PROTO_NAME_DCCP: \u0027dccp\u0027,"},{"line_number":205,"context_line":"                         PROTO_NAME_ICMP: \u0027icmp\u0027,"},{"line_number":206,"context_line":"                         PROTO_NAME_IPV6_ICMP: \u0027icmp6\u0027,"},{"line_number":207,"context_line":"                         PROTO_NAME_SCTP: \u0027sctp\u0027,"}],"source_content_type":"text/x-python","patch_set":18,"id":"ba5201f7_603f8287","line":204,"range":{"start_line":204,"start_character":0,"end_line":204,"end_character":21},"in_reply_to":"ba5201f7_2a61e539","updated":"2017-01-05 15:27:23.000000000","message":"See comment at https://review.openstack.org/#/c/409343/18/neutron_lib/api/converters.py@223","commit_id":"ca4f887d2a753ccbd7e2f516fe9619173d7a192f"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"7f3e69162699dd42ec671b54c8c8e072a76fca0a","unresolved":false,"context_lines":[{"line_number":194,"context_line":"                   PROTO_NAME_UDPLITE: PROTO_NUM_UDPLITE,"},{"line_number":195,"context_line":"                   PROTO_NAME_VRRP: PROTO_NUM_VRRP}"},{"line_number":196,"context_line":""},{"line_number":197,"context_line":"# When using iptables-save we specify \u0027-p {proto} -m {module}\u0027,"},{"line_number":198,"context_line":"# but sometimes those values are not identical.  This is a map"},{"line_number":199,"context_line":"# of known protocols that require a \u0027-m {module}\u0027, along with"},{"line_number":200,"context_line":"# the module name that should be used."}],"source_content_type":"text/x-python","patch_set":20,"id":"ba5201f7_6891fcf0","line":197,"updated":"2017-01-05 18:16:53.000000000","message":"Does this comment belong here? Seems a little consumer specific to me.","commit_id":"b4f762049fa4977518e7adab1cb4608de9fa4b69"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"b2650d4c54e16b973a218b86bd16ed7dd04f474e","unresolved":false,"context_lines":[{"line_number":194,"context_line":"                   PROTO_NAME_UDPLITE: PROTO_NUM_UDPLITE,"},{"line_number":195,"context_line":"                   PROTO_NAME_VRRP: PROTO_NUM_VRRP}"},{"line_number":196,"context_line":""},{"line_number":197,"context_line":"# When using iptables-save we specify \u0027-p {proto} -m {module}\u0027,"},{"line_number":198,"context_line":"# but sometimes those values are not identical.  This is a map"},{"line_number":199,"context_line":"# of known protocols that require a \u0027-m {module}\u0027, along with"},{"line_number":200,"context_line":"# the module name that should be used."}],"source_content_type":"text/x-python","patch_set":20,"id":"ba5201f7_533764fe","line":197,"in_reply_to":"ba5201f7_6891fcf0","updated":"2017-01-06 16:38:13.000000000","message":"OK, I see your point.  Excised.","commit_id":"b4f762049fa4977518e7adab1cb4608de9fa4b69"}],"neutron_lib/tests/unit/api/test_validators.py":[{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"3916d02afec9b1a89ef78fbf275b33d0c2618a1f","unresolved":false,"context_lines":[{"line_number":1075,"context_line":"                         validators.validate_ip_or_subnet_or_none(testdata))"},{"line_number":1076,"context_line":""},{"line_number":1077,"context_line":""},{"line_number":1078,"context_line":"class TestPortRangeValidation(base.BaseTestCase):"},{"line_number":1079,"context_line":""},{"line_number":1080,"context_line":"    def test_valid_port(self):"},{"line_number":1081,"context_line":"        result \u003d validators.validate_port_range(80)"}],"source_content_type":"text/x-python","patch_set":10,"id":"1a6eadb0_f30ec78a","line":1078,"updated":"2016-12-15 13:38:38.000000000","message":"As mentioning in the validator, I think a range with multiple colons will validate (e.g. 10:100:1000:10000)","commit_id":"9d2e858cd122568903a6cdcd47f941b9746bd9f5"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"ccff6267c77f8514b7ebbc3497039696a0e65e54","unresolved":false,"context_lines":[{"line_number":1075,"context_line":"                         validators.validate_ip_or_subnet_or_none(testdata))"},{"line_number":1076,"context_line":""},{"line_number":1077,"context_line":""},{"line_number":1078,"context_line":"class TestPortRangeValidation(base.BaseTestCase):"},{"line_number":1079,"context_line":""},{"line_number":1080,"context_line":"    def test_valid_port(self):"},{"line_number":1081,"context_line":"        result \u003d validators.validate_port_range(80)"}],"source_content_type":"text/x-python","patch_set":10,"id":"1a6eadb0_aee5b938","line":1078,"in_reply_to":"1a6eadb0_f30ec78a","updated":"2016-12-15 17:42:17.000000000","message":"I think I fixed that in the validator; added a test for it.","commit_id":"9d2e858cd122568903a6cdcd47f941b9746bd9f5"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"3916d02afec9b1a89ef78fbf275b33d0c2618a1f","unresolved":false,"context_lines":[{"line_number":1079,"context_line":""},{"line_number":1080,"context_line":"    def test_valid_port(self):"},{"line_number":1081,"context_line":"        result \u003d validators.validate_port_range(80)"},{"line_number":1082,"context_line":"        self.assertEqual(None, result)"},{"line_number":1083,"context_line":""},{"line_number":1084,"context_line":"    def test_valid_range(self):"},{"line_number":1085,"context_line":"        result \u003d validators.validate_port_range(\"80:8888\")"}],"source_content_type":"text/x-python","patch_set":10,"id":"1a6eadb0_33259f08","line":1082,"range":{"start_line":1082,"start_character":13,"end_line":1082,"end_character":24},"updated":"2016-12-15 13:38:38.000000000","message":"assertIsNone","commit_id":"9d2e858cd122568903a6cdcd47f941b9746bd9f5"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"ccff6267c77f8514b7ebbc3497039696a0e65e54","unresolved":false,"context_lines":[{"line_number":1079,"context_line":""},{"line_number":1080,"context_line":"    def test_valid_port(self):"},{"line_number":1081,"context_line":"        result \u003d validators.validate_port_range(80)"},{"line_number":1082,"context_line":"        self.assertEqual(None, result)"},{"line_number":1083,"context_line":""},{"line_number":1084,"context_line":"    def test_valid_range(self):"},{"line_number":1085,"context_line":"        result \u003d validators.validate_port_range(\"80:8888\")"}],"source_content_type":"text/x-python","patch_set":10,"id":"1a6eadb0_8e955d88","line":1082,"range":{"start_line":1082,"start_character":13,"end_line":1082,"end_character":24},"in_reply_to":"1a6eadb0_33259f08","updated":"2016-12-15 17:42:17.000000000","message":"Done","commit_id":"9d2e858cd122568903a6cdcd47f941b9746bd9f5"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"3916d02afec9b1a89ef78fbf275b33d0c2618a1f","unresolved":false,"context_lines":[{"line_number":1083,"context_line":""},{"line_number":1084,"context_line":"    def test_valid_range(self):"},{"line_number":1085,"context_line":"        result \u003d validators.validate_port_range(\"80:8888\")"},{"line_number":1086,"context_line":"        self.assertEqual(None, result)"},{"line_number":1087,"context_line":""},{"line_number":1088,"context_line":"    def test_port_too_high(self):"},{"line_number":1089,"context_line":"        result \u003d validators.validate_port_range(99999)"}],"source_content_type":"text/x-python","patch_set":10,"id":"1a6eadb0_731b97ca","line":1086,"range":{"start_line":1086,"start_character":13,"end_line":1086,"end_character":24},"updated":"2016-12-15 13:38:38.000000000","message":"assertIsNone","commit_id":"9d2e858cd122568903a6cdcd47f941b9746bd9f5"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"ccff6267c77f8514b7ebbc3497039696a0e65e54","unresolved":false,"context_lines":[{"line_number":1083,"context_line":""},{"line_number":1084,"context_line":"    def test_valid_range(self):"},{"line_number":1085,"context_line":"        result \u003d validators.validate_port_range(\"80:8888\")"},{"line_number":1086,"context_line":"        self.assertEqual(None, result)"},{"line_number":1087,"context_line":""},{"line_number":1088,"context_line":"    def test_port_too_high(self):"},{"line_number":1089,"context_line":"        result \u003d validators.validate_port_range(99999)"}],"source_content_type":"text/x-python","patch_set":10,"id":"1a6eadb0_eeea510e","line":1086,"range":{"start_line":1086,"start_character":13,"end_line":1086,"end_character":24},"in_reply_to":"1a6eadb0_731b97ca","updated":"2016-12-15 17:42:17.000000000","message":"Done","commit_id":"9d2e858cd122568903a6cdcd47f941b9746bd9f5"}],"releasenotes/notes/fwaas_converters_validators-c310900b4386146e.yaml":[{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"4317ca1b463469f82c9aa1950ef1acd602300ef7","unresolved":false,"context_lines":[{"line_number":1,"context_line":"---"},{"line_number":2,"context_line":"features:"},{"line_number":3,"context_line":"  - Added the converter ``convert_to_string``"},{"line_number":4,"context_line":"  - Added the converter ``convert_string_to_case_insensitive``"},{"line_number":5,"context_line":"  - Added the converter ``convert_protocol``"},{"line_number":6,"context_line":"  - Added the validator ``validate_port_range``"}],"source_content_type":"text/x-yaml","patch_set":14,"id":"1a6eadb0_e58c22dc","line":3,"updated":"2016-12-16 01:59:19.000000000","message":"trailing periods?","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"7ed3ea73f1b7dcd12bda3afbfab3141e52db9fb0","unresolved":false,"context_lines":[{"line_number":1,"context_line":"---"},{"line_number":2,"context_line":"features:"},{"line_number":3,"context_line":"  - Added the converter ``convert_to_string``"},{"line_number":4,"context_line":"  - Added the converter ``convert_string_to_case_insensitive``"},{"line_number":5,"context_line":"  - Added the converter ``convert_protocol``"},{"line_number":6,"context_line":"  - Added the validator ``validate_port_range``"}],"source_content_type":"text/x-yaml","patch_set":14,"id":"ba5201f7_03726ead","line":3,"in_reply_to":"1a6eadb0_e58c22dc","updated":"2017-01-03 21:22:26.000000000","message":"Done","commit_id":"4b251a202b8582116743544e0093642837035243"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"87ee62a92e458721a9aa4d2d1773664c39e98800","unresolved":false,"context_lines":[{"line_number":1,"context_line":"---"},{"line_number":2,"context_line":"features:"},{"line_number":3,"context_line":"  - Added the converter ``convert_to_string``."},{"line_number":4,"context_line":"  - Added the converter ``convert_string_to_case_insensitive``."},{"line_number":5,"context_line":"  - Added the converter ``convert_protocol``."},{"line_number":6,"context_line":"  - Added the validator ``validate_port_range``."}],"source_content_type":"text/x-yaml","patch_set":18,"id":"ba5201f7_cafe9937","line":3,"updated":"2017-01-04 13:51:27.000000000","message":"Where did we add convert_to_string as part of this patch?","commit_id":"ca4f887d2a753ccbd7e2f516fe9619173d7a192f"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"353ad7d57790295f50d90853b48bef6f2db0bbb0","unresolved":false,"context_lines":[{"line_number":1,"context_line":"---"},{"line_number":2,"context_line":"features:"},{"line_number":3,"context_line":"  - Added the converter ``convert_to_string``."},{"line_number":4,"context_line":"  - Added the converter ``convert_string_to_case_insensitive``."},{"line_number":5,"context_line":"  - Added the converter ``convert_protocol``."},{"line_number":6,"context_line":"  - Added the validator ``validate_port_range``."}],"source_content_type":"text/x-yaml","patch_set":18,"id":"ba5201f7_60f14201","line":3,"in_reply_to":"ba5201f7_cafe9937","updated":"2017-01-05 15:27:23.000000000","message":"I removed that in an earlier PS, and forgot to remove it here.  Deleted.","commit_id":"ca4f887d2a753ccbd7e2f516fe9619173d7a192f"}]}
