)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":8106,"name":"Haomeng,Wang","email":"wanghaomeng@gmail.com","username":"whaom"},"change_message_id":"de0b905c474077418d5f28a022f08b2be8fe0b0b","unresolved":false,"context_lines":[{"line_number":11,"context_line":"have encoded the username and password with base64."},{"line_number":12,"context_line":"We know that the base64 encode way is not safe enough,"},{"line_number":13,"context_line":"but let\u0027s just encode them first and make them not"},{"line_number":14,"context_line":"plain text at least."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"Closes-Bug: #1487948"},{"line_number":17,"context_line":"Change-Id: I6e307cd6d45fbe46faf078b0e78612e3c4b04cf7"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":28,"id":"da85f559_2cff9dab","line":14,"updated":"2015-11-10 02:30:32.000000000","message":"yes, agree with you, dont think base64 should be just an encoding, not encryption, so it will not be safe, can we select an one-way algorithm such as md5/sha to make sure it can not be \u0027decode\u0027 from our xml file?","commit_id":"6c5cd58db5ab76715bd583ba63e546ce173486df"}],"cinder/tests/unit/test_huawei_drivers.py":[{"author":{"_account_id":8846,"name":"Hao Wang","display_name":"Hao Wang","email":"sxmatch1986@gmail.com","username":"sxmatch"},"change_message_id":"74f5a01d5d61511e70151e95d50624a031c0eb12","unresolved":false,"context_lines":[{"line_number":1171,"context_line":"        self.assertEqual(\u00271\u0027, lun_info[\u0027provider_location\u0027])"},{"line_number":1172,"context_line":""},{"line_number":1173,"context_line":"    @mock.patch.object(huawei_utils, \u0027_change_file_mode\u0027)"},{"line_number":1174,"context_line":"    def test_delete_volume_success(self, mock_change_file_mode):"},{"line_number":1175,"context_line":"        self.driver.restclient.login()"},{"line_number":1176,"context_line":"        delete_flag \u003d self.driver.delete_volume(test_volume)"},{"line_number":1177,"context_line":"        self.assertTrue(delete_flag)"}],"source_content_type":"text/x-python","patch_set":3,"id":"fa1b9901_f28da131","line":1174,"updated":"2015-08-26 09:27:09.000000000","message":"Seems mock didn\u0027t work here. Maybe you can try mock_change_file_mode.reutrn_value\u003d0","commit_id":"8c321692900ce0bddfdfb5c8a545fa3656ade38f"},{"author":{"_account_id":1736,"name":"Ivan Kolodyazhny","email":"e0ne@e0ne.info","username":"e0ne"},"change_message_id":"424361e369b5a03e72b465e5aa2af878c5ac179e","unresolved":false,"context_lines":[{"line_number":1377,"context_line":"        lun_info \u003d self.driver.create_volume(test_volume)"},{"line_number":1378,"context_line":"        self.assertEqual(\u00271\u0027, lun_info[\u0027provider_location\u0027])"},{"line_number":1379,"context_line":""},{"line_number":1380,"context_line":"    @mock.patch.object(huawei_utils, \u0027_change_file_mode\u0027, return_value\u003dNone)"},{"line_number":1381,"context_line":"    def test_delete_volume_success(self, mock_change_file_mode):"},{"line_number":1382,"context_line":"        self.driver.restclient.login()"},{"line_number":1383,"context_line":"        delete_flag \u003d self.driver.delete_volume(test_volume)"}],"source_content_type":"text/x-python","patch_set":5,"id":"da20952f_b9694dc0","line":1380,"updated":"2015-09-04 19:10:03.000000000","message":"Adding such decorator doesn\u0027t look like a good design. Please move it and self.driver.restclient.login() call to the setUp method","commit_id":"8fc5816ce485575e9261e6993b1adcd2733722ba"},{"author":{"_account_id":9003,"name":"Tom Barron","email":"tpb@dyncloud.net","username":"tbarron"},"change_message_id":"2c583564ff5e127c94c3aff31fed2f76b09f7fcc","unresolved":false,"context_lines":[{"line_number":1371,"context_line":"        self.restclient \u003d Fake18000Client(configuration\u003dself.configuration)"},{"line_number":1372,"context_line":""},{"line_number":1373,"context_line":""},{"line_number":1374,"context_line":"@mock.patch(\u0027cinder.volume.drivers.huawei.huawei_utils._change_file_mode\u0027)"},{"line_number":1375,"context_line":"class Huawei18000ISCSIDriverTestCase(test.TestCase):"},{"line_number":1376,"context_line":""},{"line_number":1377,"context_line":"    def setUp(self):"}],"source_content_type":"text/x-python","patch_set":8,"id":"ba15a1d1_88cd3c33","line":1374,"updated":"2015-09-23 10:16:45.000000000","message":"As Gorka said on the mail list, when you decorate the class like this, you need to pass the mocked object to its methods as an argument.\n\nThat said, I\u0027d recommend what Ivan said in patch 5, namely to move this mock to the setUp method.  Here the context-handler style mock might serve you well:\n\n    with mock.patch(...):\n        driver \u003d ...","commit_id":"2444901185a11f8c838fe0f1c198872950f8c370"},{"author":{"_account_id":9003,"name":"Tom Barron","email":"tpb@dyncloud.net","username":"tbarron"},"change_message_id":"54a3f915e5b66534eb4b9bf0f82c2758a3013335","unresolved":false,"context_lines":[{"line_number":1371,"context_line":"        self.restclient \u003d Fake18000Client(configuration\u003dself.configuration)"},{"line_number":1372,"context_line":""},{"line_number":1373,"context_line":""},{"line_number":1374,"context_line":"@mock.patch(\u0027cinder.volume.drivers.huawei.huawei_utils._change_file_mode\u0027)"},{"line_number":1375,"context_line":"class Huawei18000ISCSIDriverTestCase(test.TestCase):"},{"line_number":1376,"context_line":""},{"line_number":1377,"context_line":"    def setUp(self):"}],"source_content_type":"text/x-python","patch_set":8,"id":"ba15a1d1_f09ccb6b","line":1374,"in_reply_to":"ba15a1d1_88cd3c33","updated":"2015-09-23 15:01:31.000000000","message":"Actually my suggestion is no good, as the scope of the mock is just the driver initialization :(\n\nI see Eric had a better way in the email thread.","commit_id":"2444901185a11f8c838fe0f1c198872950f8c370"},{"author":{"_account_id":9003,"name":"Tom Barron","email":"tpb@dyncloud.net","username":"tbarron"},"change_message_id":"650d7c87914ce3b2ba396af19367d4ae14789f1c","unresolved":false,"context_lines":[{"line_number":1389,"context_line":"        driver \u003d Fake18000ISCSIStorage(configuration\u003dself.configuration)"},{"line_number":1390,"context_line":"        self.driver \u003d driver"},{"line_number":1391,"context_line":"        self.driver.do_setup()"},{"line_number":1392,"context_line":"        with mock.patch.object(huawei_utils, \u0027_change_file_mode\u0027):"},{"line_number":1393,"context_line":"            self.driver.restclient.login()"},{"line_number":1394,"context_line":"        self.portgroup \u003d \u0027portgroup-test\u0027"},{"line_number":1395,"context_line":"        self.iscsi_iqns \u003d [\u0027iqn.2006-08.com.huawei:oceanstor:21000022a:\u0027"}],"source_content_type":"text/x-python","patch_set":11,"id":"ba15a1d1_566c6ccf","line":1392,"updated":"2015-09-24 10:12:01.000000000","message":"Since _change_file_mode only gets called from get_login_info, and that method in turn from restclient.login(), I think these are the only mock patches that you need.  That is, I think you can get rid of the mock decorator on the class and the corresponding need to pass the mocked object into every test method in that class.","commit_id":"85fee8fa02c00798ae8e4a0111c35182e6fb3e66"},{"author":{"_account_id":13900,"name":"Accela Zhao","email":"accelazh@gmail.com","username":"accelazh"},"change_message_id":"6c078716c560d5770a8a65d79d407f3c8040344f","unresolved":false,"context_lines":[{"line_number":1513,"context_line":"        driver \u003d Fake18000ISCSIStorage(configuration\u003dself.configuration)"},{"line_number":1514,"context_line":"        self.driver \u003d driver"},{"line_number":1515,"context_line":"        self.driver.do_setup()"},{"line_number":1516,"context_line":"        with mock.patch.object(huawei_utils, \u0027_change_file_mode\u0027):"},{"line_number":1517,"context_line":"            self.driver.restclient.login()"},{"line_number":1518,"context_line":"        self.portgroup \u003d \u0027portgroup-test\u0027"},{"line_number":1519,"context_line":"        self.iscsi_iqns \u003d [\u0027iqn.2006-08.com.huawei:oceanstor:21000022a:\u0027"}],"source_content_type":"text/x-python","patch_set":28,"id":"da85f559_577dd7e5","line":1516,"updated":"2015-11-09 22:39:31.000000000","message":"Good fix. But I didn\u0027t see the new base64 logic reflected in test cases.","commit_id":"6c5cd58db5ab76715bd583ba63e546ce173486df"},{"author":{"_account_id":13203,"name":"Wilson Liu","email":"295988511@qq.com","username":"Bob-OpenStack"},"change_message_id":"52644167711420d88d1e8955479b427a43166fb2","unresolved":false,"context_lines":[{"line_number":1513,"context_line":"        driver \u003d Fake18000ISCSIStorage(configuration\u003dself.configuration)"},{"line_number":1514,"context_line":"        self.driver \u003d driver"},{"line_number":1515,"context_line":"        self.driver.do_setup()"},{"line_number":1516,"context_line":"        with mock.patch.object(huawei_utils, \u0027_change_file_mode\u0027):"},{"line_number":1517,"context_line":"            self.driver.restclient.login()"},{"line_number":1518,"context_line":"        self.portgroup \u003d \u0027portgroup-test\u0027"},{"line_number":1519,"context_line":"        self.iscsi_iqns \u003d [\u0027iqn.2006-08.com.huawei:oceanstor:21000022a:\u0027"}],"source_content_type":"text/x-python","patch_set":28,"id":"da85f559_06595a5a","line":1516,"in_reply_to":"da85f559_577dd7e5","updated":"2015-11-10 02:10:16.000000000","message":"Done","commit_id":"6c5cd58db5ab76715bd583ba63e546ce173486df"}],"cinder/volume/drivers/huawei/huawei_utils.py":[{"author":{"_account_id":8911,"name":"Sergey Vilgelm","email":"sergey@vilgelm.info","username":"sergey.vilgelm"},"change_message_id":"123b79b572d0d778a0c2f96d1debba45bdf4a7b4","unresolved":false,"context_lines":[{"line_number":454,"context_line":"        _change_file_mode(xml_file_path)"},{"line_number":455,"context_line":"        try:"},{"line_number":456,"context_line":"            tree.write(xml_file_path, \u0027UTF-8\u0027)"},{"line_number":457,"context_line":"        except Exception as err:"},{"line_number":458,"context_line":"            LOG.warning(_LW(\u0027Unable to access config file. %s.\u0027), err)"},{"line_number":459,"context_line":""},{"line_number":460,"context_line":"    return login_info"}],"source_content_type":"text/x-python","patch_set":2,"id":"fa1b9901_5ef5f380","line":457,"updated":"2015-08-24 08:07:09.000000000","message":"Please use more specific Exception class like IOError","commit_id":"05a11d0ec5a52ba78adae17782099e1c4540067d"},{"author":{"_account_id":13203,"name":"Wilson Liu","email":"295988511@qq.com","username":"Bob-OpenStack"},"change_message_id":"1ddfc362312149f364e173abfebccdaa7c11983f","unresolved":false,"context_lines":[{"line_number":454,"context_line":"        _change_file_mode(xml_file_path)"},{"line_number":455,"context_line":"        try:"},{"line_number":456,"context_line":"            tree.write(xml_file_path, \u0027UTF-8\u0027)"},{"line_number":457,"context_line":"        except Exception as err:"},{"line_number":458,"context_line":"            LOG.warning(_LW(\u0027Unable to access config file. %s.\u0027), err)"},{"line_number":459,"context_line":""},{"line_number":460,"context_line":"    return login_info"}],"source_content_type":"text/x-python","patch_set":2,"id":"fa1b9901_dc6d7d9a","line":457,"in_reply_to":"fa1b9901_5ef5f380","updated":"2015-08-25 01:58:38.000000000","message":"Thanks, but I\u0027m not sure which exception will raise here and I won\u0027t omit any exception if there really is.","commit_id":"05a11d0ec5a52ba78adae17782099e1c4540067d"},{"author":{"_account_id":8911,"name":"Sergey Vilgelm","email":"sergey@vilgelm.info","username":"sergey.vilgelm"},"change_message_id":"c75161ee6622da262dec210defa6a24fd9017183","unresolved":false,"context_lines":[{"line_number":445,"context_line":"        node \u003d root.find(\u0027Storage/%s\u0027 % key)"},{"line_number":446,"context_line":"        node_text \u003d node.text"},{"line_number":447,"context_line":"        # Prefix !$$$ means encoded already."},{"line_number":448,"context_line":"        if node_text.find(\u0027!$$$\u0027) \u003e -1:"},{"line_number":449,"context_line":"            login_info[key] \u003d base64.b64decode(node_text[4:])"},{"line_number":450,"context_line":"        else:"},{"line_number":451,"context_line":"            login_info[key] \u003d node_text"}],"source_content_type":"text/x-python","patch_set":3,"id":"fa1b9901_b5ef1e1c","line":448,"updated":"2015-08-26 05:07:07.000000000","message":"Use the .startswith instead of .find function\n    if node_text.startswith(\u0027!$$$\u0027):","commit_id":"8c321692900ce0bddfdfb5c8a545fa3656ade38f"},{"author":{"_account_id":13203,"name":"Wilson Liu","email":"295988511@qq.com","username":"Bob-OpenStack"},"change_message_id":"ec5cf752c45bf6faa4724939c0cd16d2cb3ca26e","unresolved":false,"context_lines":[{"line_number":445,"context_line":"        node \u003d root.find(\u0027Storage/%s\u0027 % key)"},{"line_number":446,"context_line":"        node_text \u003d node.text"},{"line_number":447,"context_line":"        # Prefix !$$$ means encoded already."},{"line_number":448,"context_line":"        if node_text.find(\u0027!$$$\u0027) \u003e -1:"},{"line_number":449,"context_line":"            login_info[key] \u003d base64.b64decode(node_text[4:])"},{"line_number":450,"context_line":"        else:"},{"line_number":451,"context_line":"            login_info[key] \u003d node_text"}],"source_content_type":"text/x-python","patch_set":3,"id":"fa1b9901_63469ec1","line":448,"in_reply_to":"fa1b9901_b5ef1e1c","updated":"2015-09-01 14:18:30.000000000","message":"Done","commit_id":"8c321692900ce0bddfdfb5c8a545fa3656ade38f"},{"author":{"_account_id":8911,"name":"Sergey Vilgelm","email":"sergey@vilgelm.info","username":"sergey.vilgelm"},"change_message_id":"c75161ee6622da262dec210defa6a24fd9017183","unresolved":false,"context_lines":[{"line_number":455,"context_line":"        _change_file_mode(xml_file_path)"},{"line_number":456,"context_line":"        try:"},{"line_number":457,"context_line":"            tree.write(xml_file_path, \u0027UTF-8\u0027)"},{"line_number":458,"context_line":"        except Exception as err:"},{"line_number":459,"context_line":"            LOG.warning(_LW(\u0027Unable to access config file. %s.\u0027), err)"},{"line_number":460,"context_line":""},{"line_number":461,"context_line":"    return login_info"}],"source_content_type":"text/x-python","patch_set":3,"id":"fa1b9901_953f7ab3","line":458,"updated":"2015-08-26 05:07:07.000000000","message":"I guess for 99% that the IOError will be here","commit_id":"8c321692900ce0bddfdfb5c8a545fa3656ade38f"},{"author":{"_account_id":13203,"name":"Wilson Liu","email":"295988511@qq.com","username":"Bob-OpenStack"},"change_message_id":"ec5cf752c45bf6faa4724939c0cd16d2cb3ca26e","unresolved":false,"context_lines":[{"line_number":455,"context_line":"        _change_file_mode(xml_file_path)"},{"line_number":456,"context_line":"        try:"},{"line_number":457,"context_line":"            tree.write(xml_file_path, \u0027UTF-8\u0027)"},{"line_number":458,"context_line":"        except Exception as err:"},{"line_number":459,"context_line":"            LOG.warning(_LW(\u0027Unable to access config file. %s.\u0027), err)"},{"line_number":460,"context_line":""},{"line_number":461,"context_line":"    return login_info"}],"source_content_type":"text/x-python","patch_set":3,"id":"fa1b9901_2313c6b9","line":458,"in_reply_to":"fa1b9901_953f7ab3","updated":"2015-09-01 14:18:30.000000000","message":"Done","commit_id":"8c321692900ce0bddfdfb5c8a545fa3656ade38f"},{"author":{"_account_id":16917,"name":"Alex O\u0027Rourke","email":"alex.orourke@hpe.com","username":"aorourke"},"change_message_id":"ddc0a4d030b561f9f431155ca1040e003f3fd270","unresolved":false,"context_lines":[{"line_number":451,"context_line":"            node.text \u003d \u0027!$$$\u0027 + base64.b64encode(node_text)"},{"line_number":452,"context_line":"            need_encode \u003d True"},{"line_number":453,"context_line":"    if need_encode:"},{"line_number":454,"context_line":"        _change_file_mode(xml_file_path)"},{"line_number":455,"context_line":"        try:"},{"line_number":456,"context_line":"            tree.write(xml_file_path, \u0027UTF-8\u0027)"},{"line_number":457,"context_line":"        except IOError as err:"}],"source_content_type":"text/x-python","patch_set":5,"id":"da20952f_89e60e43","line":454,"updated":"2015-09-01 22:43:46.000000000","message":"Do you need to change the file permissions back?","commit_id":"8fc5816ce485575e9261e6993b1adcd2733722ba"},{"author":{"_account_id":8846,"name":"Hao Wang","display_name":"Hao Wang","email":"sxmatch1986@gmail.com","username":"sxmatch"},"change_message_id":"580f6facc79d43510f05d18173afd330cf074bb9","unresolved":false,"context_lines":[{"line_number":451,"context_line":"            node.text \u003d \u0027!$$$\u0027 + base64.b64encode(node_text)"},{"line_number":452,"context_line":"            need_encode \u003d True"},{"line_number":453,"context_line":"    if need_encode:"},{"line_number":454,"context_line":"        _change_file_mode(xml_file_path)"},{"line_number":455,"context_line":"        try:"},{"line_number":456,"context_line":"            tree.write(xml_file_path, \u0027UTF-8\u0027)"},{"line_number":457,"context_line":"        except IOError as err:"}],"source_content_type":"text/x-python","patch_set":5,"id":"da20952f_53e55706","line":454,"in_reply_to":"da20952f_89e60e43","updated":"2015-09-06 10:03:19.000000000","message":"Agree, should change the permissions back.","commit_id":"8fc5816ce485575e9261e6993b1adcd2733722ba"},{"author":{"_account_id":16917,"name":"Alex O\u0027Rourke","email":"alex.orourke@hpe.com","username":"aorourke"},"change_message_id":"541817941570c40c99996ec7058598330476fba4","unresolved":false,"context_lines":[{"line_number":451,"context_line":"            node.text \u003d \u0027!$$$\u0027 + base64.b64encode(node_text)"},{"line_number":452,"context_line":"            need_encode \u003d True"},{"line_number":453,"context_line":"    if need_encode:"},{"line_number":454,"context_line":"        _change_file_mode(xml_file_path)"},{"line_number":455,"context_line":"        try:"},{"line_number":456,"context_line":"            tree.write(xml_file_path, \u0027UTF-8\u0027)"},{"line_number":457,"context_line":"        except IOError as err:"}],"source_content_type":"text/x-python","patch_set":6,"id":"ba15a1d1_f9186c77","line":454,"updated":"2015-09-22 15:42:19.000000000","message":"This was never addressed, shouldn\u0027t the file permissions be changed back?","commit_id":"8aa2ba561612ab6d1c86e48ae4e3f876a96e7502"},{"author":{"_account_id":14377,"name":"Apoorva","email":"apps.desh@gmail.com","username":"apoorvad"},"change_message_id":"4a063596de78a137ab5b61e3bb90a9bdb7cbfca7","unresolved":false,"context_lines":[{"line_number":435,"context_line":"def get_login_info(xml_file_path):"},{"line_number":436,"context_line":"    \"\"\"Get login IP, user name and password from config file.\"\"\""},{"line_number":437,"context_line":"    login_info \u003d {}"},{"line_number":438,"context_line":"    tree \u003d ET.parse(xml_file_path)"},{"line_number":439,"context_line":"    root \u003d tree.getroot()"},{"line_number":440,"context_line":"    login_info[\u0027RestURL\u0027] \u003d root.findtext(\u0027Storage/RestURL\u0027).strip()"},{"line_number":441,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"ba15a1d1_6b00c634","line":438,"updated":"2015-09-23 19:13:06.000000000","message":"There is a possibility of IOError, do you want to handle it?","commit_id":"495383ff6554ae9d207a9b63e164a18844f055cb"},{"author":{"_account_id":14377,"name":"Apoorva","email":"apps.desh@gmail.com","username":"apoorvad"},"change_message_id":"4a063596de78a137ab5b61e3bb90a9bdb7cbfca7","unresolved":false,"context_lines":[{"line_number":453,"context_line":"    if need_encode:"},{"line_number":454,"context_line":"        _change_file_mode(xml_file_path)"},{"line_number":455,"context_line":"        try:"},{"line_number":456,"context_line":"            tree.write(xml_file_path, \u0027UTF-8\u0027)"},{"line_number":457,"context_line":"        except IOError as err:"},{"line_number":458,"context_line":"            LOG.warning(_LW(\u0027Unable to access config file. %s.\u0027), err)"},{"line_number":459,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"ba15a1d1_eb6856f7","line":456,"updated":"2015-09-23 19:13:06.000000000","message":"If you create a utility function for writing the tree, you can conveniently handle changing/restoring file permission there. Else you will have to handle file permissions and restore here.","commit_id":"495383ff6554ae9d207a9b63e164a18844f055cb"},{"author":{"_account_id":14101,"name":"yapeng Yang","email":"a394954369@gmail.com","username":"yapeng"},"change_message_id":"ed128cf7e3a75229d1314384ab3778b8eb0bff4f","unresolved":false,"context_lines":[{"line_number":453,"context_line":"    if need_encode:"},{"line_number":454,"context_line":"        _change_file_mode(xml_file_path)"},{"line_number":455,"context_line":"        try:"},{"line_number":456,"context_line":"            tree.write(xml_file_path, \u0027UTF-8\u0027)"},{"line_number":457,"context_line":"        except IOError as err:"},{"line_number":458,"context_line":"            LOG.warning(_LW(\u0027Unable to access config file. %s.\u0027), err)"},{"line_number":459,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"ba15a1d1_3f32fd10","line":456,"in_reply_to":"ba15a1d1_eb6856f7","updated":"2015-09-24 01:11:46.000000000","message":"Done","commit_id":"495383ff6554ae9d207a9b63e164a18844f055cb"},{"author":{"_account_id":14377,"name":"Apoorva","email":"apps.desh@gmail.com","username":"apoorvad"},"change_message_id":"4a063596de78a137ab5b61e3bb90a9bdb7cbfca7","unresolved":false,"context_lines":[{"line_number":460,"context_line":"    return login_info"},{"line_number":461,"context_line":""},{"line_number":462,"context_line":""},{"line_number":463,"context_line":"def _change_file_mode(filepath):"},{"line_number":464,"context_line":"    utils.execute(\u0027chmod\u0027, \u0027600\u0027, filepath, run_as_root\u003dTrue)"},{"line_number":465,"context_line":""},{"line_number":466,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"ba15a1d1_ebe296d4","line":463,"updated":"2015-09-23 19:13:06.000000000","message":"For better readability you can consider renaming it to something similar to _rw_to_owner_permission or pass in file permissions as an argument.","commit_id":"495383ff6554ae9d207a9b63e164a18844f055cb"},{"author":{"_account_id":14131,"name":"shaohef","email":"shaohe.feng@intel.com","username":"shaohefeng"},"change_message_id":"029e70aad66b81bcfc3675bae3c74377b871a810","unresolved":false,"context_lines":[{"line_number":439,"context_line":"        tree \u003d ET.parse(xml_file_path)"},{"line_number":440,"context_line":"    except IOError as err:"},{"line_number":441,"context_line":"        LOG.warning(_LW(\u0027Unable to access config file. %s.\u0027), err)"},{"line_number":442,"context_line":"    root \u003d tree.getroot()"},{"line_number":443,"context_line":"    login_info[\u0027RestURL\u0027] \u003d root.findtext(\u0027Storage/RestURL\u0027).strip()"},{"line_number":444,"context_line":""},{"line_number":445,"context_line":"    need_encode \u003d False"}],"source_content_type":"text/x-python","patch_set":11,"id":"ba15a1d1_4c73864e","line":442,"updated":"2015-09-24 07:56:40.000000000","message":"when IOError, How do can you continue to get the root? \n\n\n$ ipython\nIn [1]: from xml.etree import ElementTree as ET\n\nIn [2]: tree \u003d ET.parse(\"xml_file_path\")\n---------------------------------------------------------------------------\nIOError                                   Traceback (most recent call last)\n\u003cipython-input-2-686d0307d075\u003e in \u003cmodule\u003e()\n----\u003e 1 tree \u003d ET.parse(\"xml_file_path\")\n\nIOError: [Errno 2] No such file or directory: \u0027xml_file_path\u0027\n\nIn [3]: root \u003d tree.getroot()\n---------------------------------------------------------------------------\nNameError                                 Traceback (most recent call last)\n\u003cipython-input-3-a601c087f1ad\u003e in \u003cmodule\u003e()\n----\u003e 1 root \u003d tree.getroot()\n\nNameError: name \u0027tree\u0027 is not defined","commit_id":"85fee8fa02c00798ae8e4a0111c35182e6fb3e66"},{"author":{"_account_id":8846,"name":"Hao Wang","display_name":"Hao Wang","email":"sxmatch1986@gmail.com","username":"sxmatch"},"change_message_id":"ddc551bba538ae9e29bff6963d7bbd050d559b29","unresolved":false,"context_lines":[{"line_number":453,"context_line":"            login_info[key] \u003d base64.b64decode(node_text[4:])"},{"line_number":454,"context_line":"        else:"},{"line_number":455,"context_line":"            login_info[key] \u003d node_text"},{"line_number":456,"context_line":"            node.text \u003d \u0027!$$$\u0027 + base64.b64encode(node_text.encode(\u0027ascii\u0027))"},{"line_number":457,"context_line":"            need_encode \u003d True"},{"line_number":458,"context_line":"    if need_encode:"},{"line_number":459,"context_line":"        _change_file_mode(xml_file_path, \u0027600\u0027)"}],"source_content_type":"text/x-python","patch_set":12,"id":"9a1a9d01_1179dc93","line":456,"updated":"2015-09-24 15:27:14.000000000","message":"Since bytes can\u0027t connect with str in Python 3, so the tests will fail. Try str(base64.b64encode(node_text.encode(\u0027ascii\u0027))).","commit_id":"324c53ec9ccd09a8d1065130189f2fe37571f332"},{"author":{"_account_id":16917,"name":"Alex O\u0027Rourke","email":"alex.orourke@hpe.com","username":"aorourke"},"change_message_id":"f32aeb72fb3811a4148d382dca461c0199a73b46","unresolved":false,"context_lines":[{"line_number":453,"context_line":"            login_info[key] \u003d base64.b64decode(node_text[4:])"},{"line_number":454,"context_line":"        else:"},{"line_number":455,"context_line":"            login_info[key] \u003d node_text"},{"line_number":456,"context_line":"            node.text \u003d \u0027!$$$\u0027 + base64.b64encode(node_text.encode(\u0027ascii\u0027))"},{"line_number":457,"context_line":"            need_encode \u003d True"},{"line_number":458,"context_line":"    if need_encode:"},{"line_number":459,"context_line":"        _change_file_mode(xml_file_path, \u0027600\u0027)"}],"source_content_type":"text/x-python","patch_set":12,"id":"9a1a9d01_8ccb9372","line":456,"in_reply_to":"9a1a9d01_1179dc93","updated":"2015-09-24 15:40:07.000000000","message":"six.test_type(base64.b64encode(node_text.encode(\u0027ascii\u0027))) would be better if you go that route.","commit_id":"324c53ec9ccd09a8d1065130189f2fe37571f332"},{"author":{"_account_id":16917,"name":"Alex O\u0027Rourke","email":"alex.orourke@hpe.com","username":"aorourke"},"change_message_id":"206aa14ebcaab0cb394f875932d09d184bfc010c","unresolved":false,"context_lines":[{"line_number":453,"context_line":"            login_info[key] \u003d base64.b64decode(node_text[4:])"},{"line_number":454,"context_line":"        else:"},{"line_number":455,"context_line":"            login_info[key] \u003d node_text"},{"line_number":456,"context_line":"            node.text \u003d \u0027!$$$\u0027 + base64.b64encode(node_text.encode(\u0027ascii\u0027))"},{"line_number":457,"context_line":"            need_encode \u003d True"},{"line_number":458,"context_line":"    if need_encode:"},{"line_number":459,"context_line":"        _change_file_mode(xml_file_path, \u0027600\u0027)"}],"source_content_type":"text/x-python","patch_set":12,"id":"9a1a9d01_201dab73","line":456,"in_reply_to":"9a1a9d01_8ccb9372","updated":"2015-09-24 16:07:48.000000000","message":"six.text_type, sorry about that","commit_id":"324c53ec9ccd09a8d1065130189f2fe37571f332"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"449f9517889e84b6b4d4b2963a9f5d023c2a37f4","unresolved":false,"context_lines":[{"line_number":444,"context_line":"    root \u003d tree.getroot()"},{"line_number":445,"context_line":"    login_info[\u0027RestURL\u0027] \u003d root.findtext(\u0027Storage/RestURL\u0027).strip()"},{"line_number":446,"context_line":""},{"line_number":447,"context_line":"    need_encode \u003d False"},{"line_number":448,"context_line":"    for key in [\u0027UserName\u0027, \u0027UserPassword\u0027]:"},{"line_number":449,"context_line":"        node \u003d root.find(\u0027Storage/%s\u0027 % key)"},{"line_number":450,"context_line":"        node_text \u003d node.text"}],"source_content_type":"text/x-python","patch_set":23,"id":"5a2ca52d_49f69a90","line":447,"updated":"2015-10-14 10:49:55.000000000","message":"nit: s/need_encode/need_saving","commit_id":"4400dafa47af8faee45e1934cf542ec32b4dd69f"},{"author":{"_account_id":13900,"name":"Accela Zhao","email":"accelazh@gmail.com","username":"accelazh"},"change_message_id":"6c078716c560d5770a8a65d79d407f3c8040344f","unresolved":false,"context_lines":[{"line_number":451,"context_line":"        node \u003d root.find(\u0027Storage/%s\u0027 % key)"},{"line_number":452,"context_line":"        node_text \u003d node.text"},{"line_number":453,"context_line":"        # Prefix !$$$ means encoded already."},{"line_number":454,"context_line":"        if node_text.startswith(\u0027!$$$\u0027):"},{"line_number":455,"context_line":"            login_info[key] \u003d six.text_type(base64.b64decode(node_text[4:]))"},{"line_number":456,"context_line":"        else:"},{"line_number":457,"context_line":"            login_info[key] \u003d node_text"}],"source_content_type":"text/x-python","patch_set":28,"id":"da85f559_bc550851","line":454,"updated":"2015-11-09 22:39:31.000000000","message":"I think you can extract \u0027!$$$\u0027 as a constant since it is kind of magic.","commit_id":"6c5cd58db5ab76715bd583ba63e546ce173486df"},{"author":{"_account_id":8106,"name":"Haomeng,Wang","email":"wanghaomeng@gmail.com","username":"whaom"},"change_message_id":"de0b905c474077418d5f28a022f08b2be8fe0b0b","unresolved":false,"context_lines":[{"line_number":451,"context_line":"        node \u003d root.find(\u0027Storage/%s\u0027 % key)"},{"line_number":452,"context_line":"        node_text \u003d node.text"},{"line_number":453,"context_line":"        # Prefix !$$$ means encoded already."},{"line_number":454,"context_line":"        if node_text.startswith(\u0027!$$$\u0027):"},{"line_number":455,"context_line":"            login_info[key] \u003d six.text_type(base64.b64decode(node_text[4:]))"},{"line_number":456,"context_line":"        else:"},{"line_number":457,"context_line":"            login_info[key] \u003d node_text"}],"source_content_type":"text/x-python","patch_set":28,"id":"da85f559_0c917999","line":454,"in_reply_to":"da85f559_bc550851","updated":"2015-11-10 02:30:32.000000000","message":"+1","commit_id":"6c5cd58db5ab76715bd583ba63e546ce173486df"},{"author":{"_account_id":13203,"name":"Wilson Liu","email":"295988511@qq.com","username":"Bob-OpenStack"},"change_message_id":"52644167711420d88d1e8955479b427a43166fb2","unresolved":false,"context_lines":[{"line_number":451,"context_line":"        node \u003d root.find(\u0027Storage/%s\u0027 % key)"},{"line_number":452,"context_line":"        node_text \u003d node.text"},{"line_number":453,"context_line":"        # Prefix !$$$ means encoded already."},{"line_number":454,"context_line":"        if node_text.startswith(\u0027!$$$\u0027):"},{"line_number":455,"context_line":"            login_info[key] \u003d six.text_type(base64.b64decode(node_text[4:]))"},{"line_number":456,"context_line":"        else:"},{"line_number":457,"context_line":"            login_info[key] \u003d node_text"}],"source_content_type":"text/x-python","patch_set":28,"id":"da85f559_a6472e76","line":454,"in_reply_to":"da85f559_bc550851","updated":"2015-11-10 02:10:16.000000000","message":"Done","commit_id":"6c5cd58db5ab76715bd583ba63e546ce173486df"},{"author":{"_account_id":13900,"name":"Accela Zhao","email":"accelazh@gmail.com","username":"accelazh"},"change_message_id":"6c078716c560d5770a8a65d79d407f3c8040344f","unresolved":false,"context_lines":[{"line_number":452,"context_line":"        node_text \u003d node.text"},{"line_number":453,"context_line":"        # Prefix !$$$ means encoded already."},{"line_number":454,"context_line":"        if node_text.startswith(\u0027!$$$\u0027):"},{"line_number":455,"context_line":"            login_info[key] \u003d six.text_type(base64.b64decode(node_text[4:]))"},{"line_number":456,"context_line":"        else:"},{"line_number":457,"context_line":"            login_info[key] \u003d node_text"},{"line_number":458,"context_line":"            encoded \u003d six.text_type("}],"source_content_type":"text/x-python","patch_set":28,"id":"da85f559_1cd534b8","line":455,"updated":"2015-11-09 22:39:31.000000000","message":"Replace the \u00274\u0027 with len() of above constant?","commit_id":"6c5cd58db5ab76715bd583ba63e546ce173486df"},{"author":{"_account_id":8106,"name":"Haomeng,Wang","email":"wanghaomeng@gmail.com","username":"whaom"},"change_message_id":"de0b905c474077418d5f28a022f08b2be8fe0b0b","unresolved":false,"context_lines":[{"line_number":452,"context_line":"        node_text \u003d node.text"},{"line_number":453,"context_line":"        # Prefix !$$$ means encoded already."},{"line_number":454,"context_line":"        if node_text.startswith(\u0027!$$$\u0027):"},{"line_number":455,"context_line":"            login_info[key] \u003d six.text_type(base64.b64decode(node_text[4:]))"},{"line_number":456,"context_line":"        else:"},{"line_number":457,"context_line":"            login_info[key] \u003d node_text"},{"line_number":458,"context_line":"            encoded \u003d six.text_type("}],"source_content_type":"text/x-python","patch_set":28,"id":"da85f559_2c8c7d7e","line":455,"in_reply_to":"da85f559_1cd534b8","updated":"2015-11-10 02:30:32.000000000","message":"+1","commit_id":"6c5cd58db5ab76715bd583ba63e546ce173486df"},{"author":{"_account_id":13203,"name":"Wilson Liu","email":"295988511@qq.com","username":"Bob-OpenStack"},"change_message_id":"52644167711420d88d1e8955479b427a43166fb2","unresolved":false,"context_lines":[{"line_number":452,"context_line":"        node_text \u003d node.text"},{"line_number":453,"context_line":"        # Prefix !$$$ means encoded already."},{"line_number":454,"context_line":"        if node_text.startswith(\u0027!$$$\u0027):"},{"line_number":455,"context_line":"            login_info[key] \u003d six.text_type(base64.b64decode(node_text[4:]))"},{"line_number":456,"context_line":"        else:"},{"line_number":457,"context_line":"            login_info[key] \u003d node_text"},{"line_number":458,"context_line":"            encoded \u003d six.text_type("}],"source_content_type":"text/x-python","patch_set":28,"id":"da85f559_465f6241","line":455,"in_reply_to":"da85f559_1cd534b8","updated":"2015-11-10 02:10:16.000000000","message":"Done","commit_id":"6c5cd58db5ab76715bd583ba63e546ce173486df"},{"author":{"_account_id":13900,"name":"Accela Zhao","email":"accelazh@gmail.com","username":"accelazh"},"change_message_id":"6c078716c560d5770a8a65d79d407f3c8040344f","unresolved":false,"context_lines":[{"line_number":457,"context_line":"            login_info[key] \u003d node_text"},{"line_number":458,"context_line":"            encoded \u003d six.text_type("},{"line_number":459,"context_line":"                base64.b64encode(node_text.encode(\u0027ascii\u0027)))"},{"line_number":460,"context_line":"            node.text \u003d \u0027!$$$\u0027 + encoded"},{"line_number":461,"context_line":"            need_saving \u003d True"},{"line_number":462,"context_line":"    if need_saving:"},{"line_number":463,"context_line":"        _change_file_mode(xml_file_path, \u0027600\u0027)"}],"source_content_type":"text/x-python","patch_set":28,"id":"da85f559_dc500c61","line":460,"updated":"2015-11-09 22:39:31.000000000","message":"Ditto.","commit_id":"6c5cd58db5ab76715bd583ba63e546ce173486df"},{"author":{"_account_id":13203,"name":"Wilson Liu","email":"295988511@qq.com","username":"Bob-OpenStack"},"change_message_id":"52644167711420d88d1e8955479b427a43166fb2","unresolved":false,"context_lines":[{"line_number":457,"context_line":"            login_info[key] \u003d node_text"},{"line_number":458,"context_line":"            encoded \u003d six.text_type("},{"line_number":459,"context_line":"                base64.b64encode(node_text.encode(\u0027ascii\u0027)))"},{"line_number":460,"context_line":"            node.text \u003d \u0027!$$$\u0027 + encoded"},{"line_number":461,"context_line":"            need_saving \u003d True"},{"line_number":462,"context_line":"    if need_saving:"},{"line_number":463,"context_line":"        _change_file_mode(xml_file_path, \u0027600\u0027)"}],"source_content_type":"text/x-python","patch_set":28,"id":"da85f559_665aa652","line":460,"in_reply_to":"da85f559_dc500c61","updated":"2015-11-10 02:10:16.000000000","message":"Done","commit_id":"6c5cd58db5ab76715bd583ba63e546ce173486df"},{"author":{"_account_id":8106,"name":"Haomeng,Wang","email":"wanghaomeng@gmail.com","username":"whaom"},"change_message_id":"de0b905c474077418d5f28a022f08b2be8fe0b0b","unresolved":false,"context_lines":[{"line_number":464,"context_line":"        try:"},{"line_number":465,"context_line":"            tree.write(xml_file_path, \u0027UTF-8\u0027)"},{"line_number":466,"context_line":"        except IOError as err:"},{"line_number":467,"context_line":"            LOG.warning(_LW(\u0027Unable to access config file. %s.\u0027), err)"},{"line_number":468,"context_line":""},{"line_number":469,"context_line":"    return login_info"},{"line_number":470,"context_line":""}],"source_content_type":"text/x-python","patch_set":28,"id":"da85f559_4c978190","line":467,"updated":"2015-11-10 02:30:32.000000000","message":"nit: how about below message which should be more exactly:\n\nLOG.warning(_LW(\u0027Unable to write config file. %s.\u0027), err)","commit_id":"6c5cd58db5ab76715bd583ba63e546ce173486df"}]}
