)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"f2fcd8776879b0041c6e5acb6b829aea46551bd7","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Augmenting the hashing strategy"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"It was only ``sha1`` algorithm being used till now to create"},{"line_number":10,"context_line":"hash of the file contents. Now included the ``md5`` hashing."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Change-Id: I8159fd64d1c074bd539817a40900e34f8fae30d4"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"5a5ae5dd_76315a59","line":10,"updated":"2016-02-08 14:56:56.000000000","message":"Thanks, few points:\n\n* Why is this change important?\n\n* The code also changes the default from \u0027sha1\u0027 to \u0027md5\u0027, this should be mentioned in the commit message","commit_id":"5a28d86245c9ef427bcd6646c135d2bc52c934e3"},{"author":{"_account_id":16635,"name":"deray","email":"debayan.ray@gmail.com","username":"deray"},"change_message_id":"0ee362cd777e5cd8c33576e0479fdb780aef7b0a","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Augmenting the hashing strategy"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"It was only ``sha1`` algorithm being used till now to create"},{"line_number":10,"context_line":"hash of the file contents. Now included the ``md5`` hashing."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Change-Id: I8159fd64d1c074bd539817a40900e34f8fae30d4"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"5a5ae5dd_488fa975","line":10,"in_reply_to":"5a5ae5dd_76315a59","updated":"2016-02-09 08:23:09.000000000","message":"* Why is this change important?\n\nAns: As part of the oob firmware update feature (https://review.openstack.org/#/c/211019/) I had to use the ``hash_file`` method to validate the checksum of the image file. And to keep the consistency with that of IPA (https://github.com/openstack/ironic-python-agent/blob/master/ironic_python_agent/extensions/standby.py#L127) I felt the need of changing method to accommodate ``md5`` hashing. Now, interestingly this ``hash_file`` method hasn\u0027t been used in the code base till now. Refer: https://github.com/openstack/ironic/search?utf8\u003d%E2%9C%93\u0026q\u003dhash_file\n\n* The code also changes the default from \u0027sha1\u0027 to \u0027md5\u0027, this should be mentioned in the commit message.\n\nAns: Now that we know this method ``hash_file`` hasn\u0027t been used till now, is it necessary to mention that in the commit message? If someone plans to use it, she will certainly refer the method doc b4 using it. wdyt?","commit_id":"5a28d86245c9ef427bcd6646c135d2bc52c934e3"},{"author":{"_account_id":11076,"name":"Shivanand Tendulker","email":"stendulker@gmail.com","username":"stendulker"},"change_message_id":"ca979a0e4da7b2fb44cd604e0cc3b8a99992485c","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Augmenting the hashing strategy"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"It was only ``sha1`` algorithm being used till now to create"},{"line_number":10,"context_line":"hash of the file contents. Now included the ``md5`` hashing."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Change-Id: I8159fd64d1c074bd539817a40900e34f8fae30d4"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"5a5ae5dd_d9b4d583","line":10,"in_reply_to":"5a5ae5dd_76315a59","updated":"2016-02-09 04:53:10.000000000","message":"+1","commit_id":"5a28d86245c9ef427bcd6646c135d2bc52c934e3"},{"author":{"_account_id":11076,"name":"Shivanand Tendulker","email":"stendulker@gmail.com","username":"stendulker"},"change_message_id":"c55e5d96f3bd9b3908753a3cd020f7662b8040c1","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Augmenting the hashing strategy"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"It was only \u0027sha1\u0027 algorithm being used till now in ``hash_file``"},{"line_number":10,"context_line":"method to create hash of the file contents. Now added \u0027md5\u0027"},{"line_number":11,"context_line":"hashing as well. As this method wasn\u0027t being used at all,"},{"line_number":12,"context_line":"therefore changing the default algorithm to \u0027md5\u0027."},{"line_number":13,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"3a57f1b5_2ce91e1b","line":10,"range":{"start_line":10,"start_character":44,"end_line":10,"end_character":59},"updated":"2016-02-10 06:43:04.000000000","message":"Can you add a note on need for \u0027md5\u0027 hashing support?","commit_id":"1f1283b749f5453f4e756ebc82c87164180d2319"},{"author":{"_account_id":16635,"name":"deray","email":"debayan.ray@gmail.com","username":"deray"},"change_message_id":"992614b3dab3a9d382d7fa327695ec7b80d5cd8c","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Augmenting the hashing strategy"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"It was only \u0027sha1\u0027 algorithm being used till now in ``hash_file``"},{"line_number":10,"context_line":"method to create hash of the file contents. Now added \u0027md5\u0027"},{"line_number":11,"context_line":"hashing as well. As this method wasn\u0027t being used at all,"},{"line_number":12,"context_line":"therefore changing the default algorithm to \u0027md5\u0027."},{"line_number":13,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"3a57f1b5_39462c24","line":10,"range":{"start_line":10,"start_character":44,"end_line":10,"end_character":59},"in_reply_to":"3a57f1b5_2ce91e1b","updated":"2016-02-10 13:07:20.000000000","message":"updated the commit msg. please check once.","commit_id":"1f1283b749f5453f4e756ebc82c87164180d2319"},{"author":{"_account_id":11076,"name":"Shivanand Tendulker","email":"stendulker@gmail.com","username":"stendulker"},"change_message_id":"fc91070bc7ec028ba3257ebfa22fbfc1a23154ed","unresolved":false,"context_lines":[{"line_number":11,"context_line":"to keep the consistency with that of IPA code base. Also, this"},{"line_number":12,"context_line":"method now supports all the algorithms hashlib does. As this"},{"line_number":13,"context_line":"method wasn\u0027t being used at all, therefore making the default"},{"line_number":14,"context_line":"algorithm to \u0027md5\u0027. Will be used in oob firmware update (manual"},{"line_number":15,"context_line":"clean step) to verify the checksum of the images."},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"Change-Id: I8159fd64d1c074bd539817a40900e34f8fae30d4"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":8,"id":"3a57f1b5_a9556ec2","line":14,"range":{"start_line":14,"start_character":36,"end_line":14,"end_character":39},"updated":"2016-02-12 12:55:48.000000000","message":"nit: s/ oob/ out of band","commit_id":"1de89030a7218279a5dd225069fee1556abdcc7c"}],"ironic/common/utils.py":[{"author":{"_account_id":11076,"name":"Shivanand Tendulker","email":"stendulker@gmail.com","username":"stendulker"},"change_message_id":"ca979a0e4da7b2fb44cd604e0cc3b8a99992485c","unresolved":false,"context_lines":[{"line_number":391,"context_line":""},{"line_number":392,"context_line":""},{"line_number":393,"context_line":"def _get_hash_object(hash_algo_name\u003d\u0027md5\u0027):"},{"line_number":394,"context_line":"    \"\"\"Create a hash object by the name of the algorithm."},{"line_number":395,"context_line":""},{"line_number":396,"context_line":"    :param hash_algo_name: name of the hashing algorithm, default \u0027md5\u0027"},{"line_number":397,"context_line":"    :returns: a hash object based on the algorithm"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a5ae5dd_198eed27","line":394,"range":{"start_line":394,"start_character":28,"end_line":394,"end_character":57},"updated":"2016-02-09 04:53:10.000000000","message":"Would it be better to say..\ns/ \u0027by the name of the algorithm.\u0027/ \u0027based on given algorithm.\u0027/","commit_id":"5a28d86245c9ef427bcd6646c135d2bc52c934e3"},{"author":{"_account_id":16635,"name":"deray","email":"debayan.ray@gmail.com","username":"deray"},"change_message_id":"0ee362cd777e5cd8c33576e0479fdb780aef7b0a","unresolved":false,"context_lines":[{"line_number":391,"context_line":""},{"line_number":392,"context_line":""},{"line_number":393,"context_line":"def _get_hash_object(hash_algo_name\u003d\u0027md5\u0027):"},{"line_number":394,"context_line":"    \"\"\"Create a hash object by the name of the algorithm."},{"line_number":395,"context_line":""},{"line_number":396,"context_line":"    :param hash_algo_name: name of the hashing algorithm, default \u0027md5\u0027"},{"line_number":397,"context_line":"    :returns: a hash object based on the algorithm"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a5ae5dd_886cc137","line":394,"range":{"start_line":394,"start_character":28,"end_line":394,"end_character":57},"in_reply_to":"5a5ae5dd_198eed27","updated":"2016-02-09 08:23:09.000000000","message":"Done","commit_id":"5a28d86245c9ef427bcd6646c135d2bc52c934e3"},{"author":{"_account_id":11076,"name":"Shivanand Tendulker","email":"stendulker@gmail.com","username":"stendulker"},"change_message_id":"ca979a0e4da7b2fb44cd604e0cc3b8a99992485c","unresolved":false,"context_lines":[{"line_number":393,"context_line":"def _get_hash_object(hash_algo_name\u003d\u0027md5\u0027):"},{"line_number":394,"context_line":"    \"\"\"Create a hash object by the name of the algorithm."},{"line_number":395,"context_line":""},{"line_number":396,"context_line":"    :param hash_algo_name: name of the hashing algorithm, default \u0027md5\u0027"},{"line_number":397,"context_line":"    :returns: a hash object based on the algorithm"},{"line_number":398,"context_line":"    \"\"\""},{"line_number":399,"context_line":"    hash_obj \u003d None"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a5ae5dd_1987cd13","line":396,"range":{"start_line":396,"start_character":58,"end_line":396,"end_character":71},"updated":"2016-02-09 04:53:10.000000000","message":"Default should be \u0027sha1\u0027 to maintain backward compatibility.","commit_id":"5a28d86245c9ef427bcd6646c135d2bc52c934e3"},{"author":{"_account_id":16635,"name":"deray","email":"debayan.ray@gmail.com","username":"deray"},"change_message_id":"0ee362cd777e5cd8c33576e0479fdb780aef7b0a","unresolved":false,"context_lines":[{"line_number":393,"context_line":"def _get_hash_object(hash_algo_name\u003d\u0027md5\u0027):"},{"line_number":394,"context_line":"    \"\"\"Create a hash object by the name of the algorithm."},{"line_number":395,"context_line":""},{"line_number":396,"context_line":"    :param hash_algo_name: name of the hashing algorithm, default \u0027md5\u0027"},{"line_number":397,"context_line":"    :returns: a hash object based on the algorithm"},{"line_number":398,"context_line":"    \"\"\""},{"line_number":399,"context_line":"    hash_obj \u003d None"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a5ae5dd_c8e5d9dc","line":396,"range":{"start_line":396,"start_character":58,"end_line":396,"end_character":71},"in_reply_to":"5a5ae5dd_1987cd13","updated":"2016-02-09 08:23:09.000000000","message":"See my answer here: https://review.openstack.org/#/c/277408/1//COMMIT_MSG I10\nLet me know if you still insist to change the default to ``sha1``.","commit_id":"5a28d86245c9ef427bcd6646c135d2bc52c934e3"},{"author":{"_account_id":11076,"name":"Shivanand Tendulker","email":"stendulker@gmail.com","username":"stendulker"},"change_message_id":"ca979a0e4da7b2fb44cd604e0cc3b8a99992485c","unresolved":false,"context_lines":[{"line_number":405,"context_line":"    return hash_obj"},{"line_number":406,"context_line":""},{"line_number":407,"context_line":""},{"line_number":408,"context_line":"def hash_file(file_like_object, hash_algo\u003d\u0027md5\u0027):"},{"line_number":409,"context_line":"    \"\"\"Generate a hash for the contents of a file."},{"line_number":410,"context_line":""},{"line_number":411,"context_line":"    :param file_like_object: file like object whose hash to be calculated"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a5ae5dd_b93b1938","line":408,"range":{"start_line":408,"start_character":32,"end_line":408,"end_character":47},"updated":"2016-02-09 04:53:10.000000000","message":"Default should be \u0027sha1\u0027 to maintain backward compatibility.","commit_id":"5a28d86245c9ef427bcd6646c135d2bc52c934e3"},{"author":{"_account_id":16635,"name":"deray","email":"debayan.ray@gmail.com","username":"deray"},"change_message_id":"0ee362cd777e5cd8c33576e0479fdb780aef7b0a","unresolved":false,"context_lines":[{"line_number":405,"context_line":"    return hash_obj"},{"line_number":406,"context_line":""},{"line_number":407,"context_line":""},{"line_number":408,"context_line":"def hash_file(file_like_object, hash_algo\u003d\u0027md5\u0027):"},{"line_number":409,"context_line":"    \"\"\"Generate a hash for the contents of a file."},{"line_number":410,"context_line":""},{"line_number":411,"context_line":"    :param file_like_object: file like object whose hash to be calculated"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a5ae5dd_28e10dd1","line":408,"range":{"start_line":408,"start_character":32,"end_line":408,"end_character":47},"in_reply_to":"5a5ae5dd_b93b1938","updated":"2016-02-09 08:23:09.000000000","message":"ditto I396","commit_id":"5a28d86245c9ef427bcd6646c135d2bc52c934e3"},{"author":{"_account_id":10343,"name":"Jim Rollenhagen","email":"jim@jimrollenhagen.com","username":"jimrollenhagen"},"change_message_id":"2a1e3ba4d931b0b359bf3b63866c0ee2973ac3b4","unresolved":false,"context_lines":[{"line_number":393,"context_line":"def _get_hash_object(hash_algo_name\u003d\u0027md5\u0027):"},{"line_number":394,"context_line":"    \"\"\"Create a hash object based on given algorithm."},{"line_number":395,"context_line":""},{"line_number":396,"context_line":"    :param hash_algo_name: name of the hashing algorithm, default \u0027md5\u0027"},{"line_number":397,"context_line":"    :returns: a hash object based on the algorithm"},{"line_number":398,"context_line":"    \"\"\""},{"line_number":399,"context_line":"    hash_obj \u003d None"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a5ae5dd_5793b2a3","line":396,"updated":"2016-02-09 15:52:21.000000000","message":"Nit: can we update this to say the choices are \u0027md5\u0027 or \u0027sha1\u0027? Otherwise someone might pass \u0027sha256\u0027 and expect valid behavior.\n\nAlso, should we raise an exception if it is *not* md5 or sha1?","commit_id":"fbd87b0160806b14f24484d7078526333fb01276"},{"author":{"_account_id":16635,"name":"deray","email":"debayan.ray@gmail.com","username":"deray"},"change_message_id":"c8974ae5f357f196b1bb5946aed2ed8dd3b1fd04","unresolved":false,"context_lines":[{"line_number":393,"context_line":"def _get_hash_object(hash_algo_name\u003d\u0027md5\u0027):"},{"line_number":394,"context_line":"    \"\"\"Create a hash object based on given algorithm."},{"line_number":395,"context_line":""},{"line_number":396,"context_line":"    :param hash_algo_name: name of the hashing algorithm, default \u0027md5\u0027"},{"line_number":397,"context_line":"    :returns: a hash object based on the algorithm"},{"line_number":398,"context_line":"    \"\"\""},{"line_number":399,"context_line":"    hash_obj \u003d None"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a57f1b5_ac68aebb","line":396,"in_reply_to":"5a5ae5dd_5793b2a3","updated":"2016-02-10 06:33:54.000000000","message":"I have raised InvalidParameterValue for the inputs other than \u0027md5\u0027/\u0027sha1\u0027. Updated the docstring of ``hash_file`` method to depict the currently supported hashes.","commit_id":"fbd87b0160806b14f24484d7078526333fb01276"},{"author":{"_account_id":11076,"name":"Shivanand Tendulker","email":"stendulker@gmail.com","username":"stendulker"},"change_message_id":"c55e5d96f3bd9b3908753a3cd020f7662b8040c1","unresolved":false,"context_lines":[{"line_number":390,"context_line":"    return file(*args, **kwargs)"},{"line_number":391,"context_line":""},{"line_number":392,"context_line":""},{"line_number":393,"context_line":"def _get_hash_object(hash_algo_name\u003d\u0027md5\u0027):"},{"line_number":394,"context_line":"    \"\"\"Create a hash object based on given algorithm."},{"line_number":395,"context_line":""},{"line_number":396,"context_line":"    :param hash_algo_name: name of the hashing algorithm, default being \u0027md5\u0027."}],"source_content_type":"text/x-python","patch_set":4,"id":"3a57f1b5_acf98eca","line":393,"range":{"start_line":393,"start_character":3,"end_line":393,"end_character":20},"updated":"2016-02-10 06:43:04.000000000","message":"Add testcases for this method.","commit_id":"1f1283b749f5453f4e756ebc82c87164180d2319"},{"author":{"_account_id":11076,"name":"Shivanand Tendulker","email":"stendulker@gmail.com","username":"stendulker"},"change_message_id":"c55e5d96f3bd9b3908753a3cd020f7662b8040c1","unresolved":false,"context_lines":[{"line_number":390,"context_line":"    return file(*args, **kwargs)"},{"line_number":391,"context_line":""},{"line_number":392,"context_line":""},{"line_number":393,"context_line":"def _get_hash_object(hash_algo_name\u003d\u0027md5\u0027):"},{"line_number":394,"context_line":"    \"\"\"Create a hash object based on given algorithm."},{"line_number":395,"context_line":""},{"line_number":396,"context_line":"    :param hash_algo_name: name of the hashing algorithm, default being \u0027md5\u0027."}],"source_content_type":"text/x-python","patch_set":4,"id":"3a57f1b5_4c633ab2","line":393,"range":{"start_line":393,"start_character":21,"end_line":393,"end_character":41},"updated":"2016-02-10 06:43:04.000000000","message":"Do you need default value here? It will always be called with a value.","commit_id":"1f1283b749f5453f4e756ebc82c87164180d2319"},{"author":{"_account_id":16635,"name":"deray","email":"debayan.ray@gmail.com","username":"deray"},"change_message_id":"992614b3dab3a9d382d7fa327695ec7b80d5cd8c","unresolved":false,"context_lines":[{"line_number":390,"context_line":"    return file(*args, **kwargs)"},{"line_number":391,"context_line":""},{"line_number":392,"context_line":""},{"line_number":393,"context_line":"def _get_hash_object(hash_algo_name\u003d\u0027md5\u0027):"},{"line_number":394,"context_line":"    \"\"\"Create a hash object based on given algorithm."},{"line_number":395,"context_line":""},{"line_number":396,"context_line":"    :param hash_algo_name: name of the hashing algorithm, default being \u0027md5\u0027."}],"source_content_type":"text/x-python","patch_set":4,"id":"3a57f1b5_6cfcf63e","line":393,"range":{"start_line":393,"start_character":21,"end_line":393,"end_character":41},"in_reply_to":"3a57f1b5_4c633ab2","updated":"2016-02-10 13:07:20.000000000","message":"hmm.. okay, as this is not getting used by any other method now, probably makes sense to have the parameter passed to it.","commit_id":"1f1283b749f5453f4e756ebc82c87164180d2319"},{"author":{"_account_id":16635,"name":"deray","email":"debayan.ray@gmail.com","username":"deray"},"change_message_id":"992614b3dab3a9d382d7fa327695ec7b80d5cd8c","unresolved":false,"context_lines":[{"line_number":390,"context_line":"    return file(*args, **kwargs)"},{"line_number":391,"context_line":""},{"line_number":392,"context_line":""},{"line_number":393,"context_line":"def _get_hash_object(hash_algo_name\u003d\u0027md5\u0027):"},{"line_number":394,"context_line":"    \"\"\"Create a hash object based on given algorithm."},{"line_number":395,"context_line":""},{"line_number":396,"context_line":"    :param hash_algo_name: name of the hashing algorithm, default being \u0027md5\u0027."}],"source_content_type":"text/x-python","patch_set":4,"id":"3a57f1b5_23827d01","line":393,"range":{"start_line":393,"start_character":3,"end_line":393,"end_character":20},"in_reply_to":"3a57f1b5_acf98eca","updated":"2016-02-10 13:07:20.000000000","message":"Done","commit_id":"1f1283b749f5453f4e756ebc82c87164180d2319"},{"author":{"_account_id":11076,"name":"Shivanand Tendulker","email":"stendulker@gmail.com","username":"stendulker"},"change_message_id":"c55e5d96f3bd9b3908753a3cd020f7662b8040c1","unresolved":false,"context_lines":[{"line_number":393,"context_line":"def _get_hash_object(hash_algo_name\u003d\u0027md5\u0027):"},{"line_number":394,"context_line":"    \"\"\"Create a hash object based on given algorithm."},{"line_number":395,"context_line":""},{"line_number":396,"context_line":"    :param hash_algo_name: name of the hashing algorithm, default being \u0027md5\u0027."},{"line_number":397,"context_line":"    :raises: InvalidParameterValue, on unsupported or invalid input."},{"line_number":398,"context_line":"    :returns: a hash object based on the given named algorithm."},{"line_number":399,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":4,"id":"3a57f1b5_4cd57a41","line":396,"range":{"start_line":396,"start_character":60,"end_line":396,"end_character":78},"updated":"2016-02-10 06:43:04.000000000","message":"add supported values here.","commit_id":"1f1283b749f5453f4e756ebc82c87164180d2319"},{"author":{"_account_id":16635,"name":"deray","email":"debayan.ray@gmail.com","username":"deray"},"change_message_id":"992614b3dab3a9d382d7fa327695ec7b80d5cd8c","unresolved":false,"context_lines":[{"line_number":393,"context_line":"def _get_hash_object(hash_algo_name\u003d\u0027md5\u0027):"},{"line_number":394,"context_line":"    \"\"\"Create a hash object based on given algorithm."},{"line_number":395,"context_line":""},{"line_number":396,"context_line":"    :param hash_algo_name: name of the hashing algorithm, default being \u0027md5\u0027."},{"line_number":397,"context_line":"    :raises: InvalidParameterValue, on unsupported or invalid input."},{"line_number":398,"context_line":"    :returns: a hash object based on the given named algorithm."},{"line_number":399,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":4,"id":"3a57f1b5_ac774ed3","line":396,"range":{"start_line":396,"start_character":60,"end_line":396,"end_character":78},"in_reply_to":"3a57f1b5_4cd57a41","updated":"2016-02-10 13:07:20.000000000","message":"Done","commit_id":"1f1283b749f5453f4e756ebc82c87164180d2319"},{"author":{"_account_id":7711,"name":"Yuriy Zveryanskyy","email":"yzveryanskyy@mirantis.com","username":"yuriyz"},"change_message_id":"ee052610a0db94adfdf9d07a7076c08dc4dbcd06","unresolved":false,"context_lines":[{"line_number":394,"context_line":"    \"\"\"Create a hash object based on given algorithm."},{"line_number":395,"context_line":""},{"line_number":396,"context_line":"    :param hash_algo_name: name of the hashing algorithm. Currently supported"},{"line_number":397,"context_line":"                           values are: \u0027md5\u0027 \u0026 \u0027sha1\u0027."},{"line_number":398,"context_line":"    :raises: InvalidParameterValue, on unsupported or invalid input."},{"line_number":399,"context_line":"    :returns: a hash object based on the given named algorithm."},{"line_number":400,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":6,"id":"3a57f1b5_5cbaaf6f","line":397,"updated":"2016-02-11 14:21:15.000000000","message":"What about more generic code:\n algorithms \u003d hashlib.algorithms_guaranteed if six.PY3 else hashlib.algorithms\n if hash_algo_name not in algorithms:\n     msg \u003d (_(\"Unsupported/Invalid hash ...\n     LOG.error(msg)\n     raise exception.InvalidParameterValue(msg)\n\n return getattr(hashlib, hash_algo_name)()","commit_id":"ad2d5790966a4f9b138e47d27a5b1280cd40e0da"},{"author":{"_account_id":16635,"name":"deray","email":"debayan.ray@gmail.com","username":"deray"},"change_message_id":"52b19c3ca5f5c8cce7aea81f287620e0427317cf","unresolved":false,"context_lines":[{"line_number":394,"context_line":"    \"\"\"Create a hash object based on given algorithm."},{"line_number":395,"context_line":""},{"line_number":396,"context_line":"    :param hash_algo_name: name of the hashing algorithm. Currently supported"},{"line_number":397,"context_line":"                           values are: \u0027md5\u0027 \u0026 \u0027sha1\u0027."},{"line_number":398,"context_line":"    :raises: InvalidParameterValue, on unsupported or invalid input."},{"line_number":399,"context_line":"    :returns: a hash object based on the given named algorithm."},{"line_number":400,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":6,"id":"3a57f1b5_03f033c8","line":397,"in_reply_to":"3a57f1b5_5cbaaf6f","updated":"2016-02-12 03:59:21.000000000","message":"aha.. elegant! :)","commit_id":"ad2d5790966a4f9b138e47d27a5b1280cd40e0da"},{"author":{"_account_id":12356,"name":"Vladyslav Drok","email":"vdrok@mirantis.com","username":"vdrok"},"change_message_id":"544861a6c3ce0c40cd409a14a8c5eec0f1d3a288","unresolved":false,"context_lines":[{"line_number":411,"context_line":"def hash_file(file_like_object, hash_algo\u003d\u0027md5\u0027):"},{"line_number":412,"context_line":"    \"\"\"Generate a hash for the contents of a file."},{"line_number":413,"context_line":""},{"line_number":414,"context_line":"    It returns a hash of the file object as a string of double length,"},{"line_number":415,"context_line":"    containing only hexadecimal digits."},{"line_number":416,"context_line":"    :param file_like_object: file like object whose hash to be calculated."},{"line_number":417,"context_line":"    :param hash_algo: name of the hashing strategy, default being \u0027md5\u0027."}],"source_content_type":"text/x-python","patch_set":7,"id":"3a57f1b5_e714f84d","line":414,"updated":"2016-02-12 10:22:14.000000000","message":"Might be worth adding that it supports all the algorithms hashlib does.","commit_id":"dbba4ce6b8e645943af100b72059e61bf62168b7"},{"author":{"_account_id":16635,"name":"deray","email":"debayan.ray@gmail.com","username":"deray"},"change_message_id":"ac2608d391780234dae266191011d16c3b9335c7","unresolved":false,"context_lines":[{"line_number":411,"context_line":"def hash_file(file_like_object, hash_algo\u003d\u0027md5\u0027):"},{"line_number":412,"context_line":"    \"\"\"Generate a hash for the contents of a file."},{"line_number":413,"context_line":""},{"line_number":414,"context_line":"    It returns a hash of the file object as a string of double length,"},{"line_number":415,"context_line":"    containing only hexadecimal digits."},{"line_number":416,"context_line":"    :param file_like_object: file like object whose hash to be calculated."},{"line_number":417,"context_line":"    :param hash_algo: name of the hashing strategy, default being \u0027md5\u0027."}],"source_content_type":"text/x-python","patch_set":7,"id":"3a57f1b5_9f79c884","line":414,"in_reply_to":"3a57f1b5_e714f84d","updated":"2016-02-12 10:58:49.000000000","message":"Done","commit_id":"dbba4ce6b8e645943af100b72059e61bf62168b7"},{"author":{"_account_id":11076,"name":"Shivanand Tendulker","email":"stendulker@gmail.com","username":"stendulker"},"change_message_id":"fc91070bc7ec028ba3257ebfa22fbfc1a23154ed","unresolved":false,"context_lines":[{"line_number":413,"context_line":""},{"line_number":414,"context_line":"    It returns a hash of the file object as a string of double length,"},{"line_number":415,"context_line":"    containing only hexadecimal digits. It supports all the algorithms"},{"line_number":416,"context_line":"    hashlib does."},{"line_number":417,"context_line":"    :param file_like_object: file like object whose hash to be calculated."},{"line_number":418,"context_line":"    :param hash_algo: name of the hashing strategy, default being \u0027md5\u0027."},{"line_number":419,"context_line":"    :raises: InvalidParameterValue, on unsupported or invalid input."}],"source_content_type":"text/x-python","patch_set":8,"id":"3a57f1b5_29497e60","line":416,"range":{"start_line":416,"start_character":4,"end_line":416,"end_character":17},"updated":"2016-02-12 12:55:48.000000000","message":"nit: Leave a blank line here.","commit_id":"1de89030a7218279a5dd225069fee1556abdcc7c"}],"ironic/tests/unit/common/test_utils.py":[{"author":{"_account_id":18893,"name":"Miles Gould","email":"mgould@redhat.com","username":"pozorvlak"},"change_message_id":"adb7daa2aaf845008565719eb0df9775c1517fdd","unresolved":false,"context_lines":[{"line_number":320,"context_line":"        # | WHEN |"},{"line_number":321,"context_line":"        hash_digest \u003d utils.hash_file(file_object_mock, \u0027sha1\u0027)"},{"line_number":322,"context_line":"        # | THEN |"},{"line_number":323,"context_line":"        self.assertEqual(sha1_hash_mock.hexdigest(), hash_digest)"},{"line_number":324,"context_line":""},{"line_number":325,"context_line":"    def test_hash_file_for_sha1_with_actual_data(self):"},{"line_number":326,"context_line":"        # | GIVEN |"}],"source_content_type":"text/x-python","patch_set":5,"id":"3a57f1b5_1acb1455","line":323,"updated":"2016-02-10 16:21:20.000000000","message":"I\u0027m not sure what the point of this test is - you\u0027re testing that utils.hash_file calls the hexdigest() method on the object returned by _get_hash_object? That seems like you\u0027re testing implementation rather than intent. Same goes for `test_hash_file_for_md5` above.","commit_id":"c8bebd0306f67e5dcebc1f22a866b62c6a222200"},{"author":{"_account_id":16635,"name":"deray","email":"debayan.ray@gmail.com","username":"deray"},"change_message_id":"43dca58a948b5f37c36ad54fb595b97f6bc1788b","unresolved":false,"context_lines":[{"line_number":320,"context_line":"        # | WHEN |"},{"line_number":321,"context_line":"        hash_digest \u003d utils.hash_file(file_object_mock, \u0027sha1\u0027)"},{"line_number":322,"context_line":"        # | THEN |"},{"line_number":323,"context_line":"        self.assertEqual(sha1_hash_mock.hexdigest(), hash_digest)"},{"line_number":324,"context_line":""},{"line_number":325,"context_line":"    def test_hash_file_for_sha1_with_actual_data(self):"},{"line_number":326,"context_line":"        # | GIVEN |"}],"source_content_type":"text/x-python","patch_set":5,"id":"3a57f1b5_928a84be","line":323,"in_reply_to":"3a57f1b5_1acb1455","updated":"2016-02-10 18:30:08.000000000","message":"I can\u0027t help but completely agree with you. Those seem to me absolute tautologies now. Will remove those in the next patch set. Thx for pointing out. I understand that these types of test cases make the UTs very tightly coupled with the unit under test and hence play adversely towards refactoring actual code base later on.","commit_id":"c8bebd0306f67e5dcebc1f22a866b62c6a222200"},{"author":{"_account_id":18893,"name":"Miles Gould","email":"mgould@redhat.com","username":"pozorvlak"},"change_message_id":"adb7daa2aaf845008565719eb0df9775c1517fdd","unresolved":false,"context_lines":[{"line_number":325,"context_line":"    def test_hash_file_for_sha1_with_actual_data(self):"},{"line_number":326,"context_line":"        # | GIVEN |"},{"line_number":327,"context_line":"        data \u003d b\u0027Mary had a little lamb, its fleece as white as snow\u0027"},{"line_number":328,"context_line":"        flo \u003d six.BytesIO(data)"},{"line_number":329,"context_line":"        expected \u003d hashlib.sha1(data).hexdigest()"},{"line_number":330,"context_line":"        # | WHEN |"},{"line_number":331,"context_line":"        actual \u003d utils.hash_file(flo, \u0027sha1\u0027)"}],"source_content_type":"text/x-python","patch_set":5,"id":"3a57f1b5_9a05c4c3","line":328,"updated":"2016-02-10 16:21:20.000000000","message":"Why is this variable called \"flo\"?","commit_id":"c8bebd0306f67e5dcebc1f22a866b62c6a222200"},{"author":{"_account_id":16635,"name":"deray","email":"debayan.ray@gmail.com","username":"deray"},"change_message_id":"43dca58a948b5f37c36ad54fb595b97f6bc1788b","unresolved":false,"context_lines":[{"line_number":325,"context_line":"    def test_hash_file_for_sha1_with_actual_data(self):"},{"line_number":326,"context_line":"        # | GIVEN |"},{"line_number":327,"context_line":"        data \u003d b\u0027Mary had a little lamb, its fleece as white as snow\u0027"},{"line_number":328,"context_line":"        flo \u003d six.BytesIO(data)"},{"line_number":329,"context_line":"        expected \u003d hashlib.sha1(data).hexdigest()"},{"line_number":330,"context_line":"        # | WHEN |"},{"line_number":331,"context_line":"        actual \u003d utils.hash_file(flo, \u0027sha1\u0027)"}],"source_content_type":"text/x-python","patch_set":5,"id":"3a57f1b5_b25a204f","line":328,"in_reply_to":"3a57f1b5_9a05c4c3","updated":"2016-02-10 18:30:08.000000000","message":"flo - file_like_object :) should I be more explicit? Doesn\u0027t harm in being explicit here.","commit_id":"c8bebd0306f67e5dcebc1f22a866b62c6a222200"}]}
