)]}'
{"osa_toolkit/filesystem.py":[{"author":{"_account_id":7219,"name":"git-harry","email":"git-harry@live.co.uk","username":"git-harry"},"change_message_id":"73d49062ba2567df55fd172d7390264d9af1ff6f","unresolved":false,"context_lines":[{"line_number":188,"context_line":""},{"line_number":189,"context_line":"    with open(hostnames_ip_file, \u0027wb\u0027) as f:"},{"line_number":190,"context_line":"        f.write("},{"line_number":191,"context_line":"            \u0027# This file is managed by openstack-ansible. No manual edits.\\n\u0027 +"},{"line_number":192,"context_line":"            json.dumps("},{"line_number":193,"context_line":"                hostnames_ips,"},{"line_number":194,"context_line":"                indent\u003d4,"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa0c359_937a7921","line":191,"updated":"2018-02-23 20:50:19.000000000","message":"This looks like it will create a file with data that cannot be directly loaded by `json.loads`, I\u0027m not familiar with the workings of this code but on the face of it that seems like it might cause issues.\n\n\u003e\u003e\u003e import json\n\u003e\u003e\u003e \n\u003e\u003e\u003e valid_json \u003d \u0027{\"a\":{\"b\":2}}\u0027\n\u003e\u003e\u003e print(valid_json)\n{\"a\":{\"b\":2}}\n\u003e\u003e\u003e\n\u003e\u003e\u003e json.loads(valid_json)\n{u\u0027a\u0027: {u\u0027b\u0027: 2}}\n\u003e\u003e\u003e \n\u003e\u003e\u003e comment \u003d \"# foo bar\\n\"\n\u003e\u003e\u003e json_with_comment \u003d comment + valid_json\n\u003e\u003e\u003e print(json_with_comment)\n# foo bar\n{\"a\":{\"b\":2}}\n\u003e\u003e\u003e \n\u003e\u003e\u003e json.loads(json_with_comment)\nTraceback (most recent call last):\n  File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\n  File \"/usr/lib/python2.7/json/__init__.py\", line 339, in loads\n    return _default_decoder.decode(s)\n  File \"/usr/lib/python2.7/json/decoder.py\", line 364, in decode\n    obj, end \u003d self.raw_decode(s, idx\u003d_w(s, 0).end())\n  File \"/usr/lib/python2.7/json/decoder.py\", line 382, in raw_decode\n    raise ValueError(\"No JSON object could be decoded\")\nValueError: No JSON object could be decoded\n\u003e\u003e\u003e","commit_id":"b45623758761e38d3936fe2274b69eee9b964e5b"},{"author":{"_account_id":24132,"name":"Maxime Guyot","email":"maxime@root314.com","username":"miouge"},"change_message_id":"94712bffd384b45c8c6a42cca23caf630aff20a2","unresolved":false,"context_lines":[{"line_number":188,"context_line":""},{"line_number":189,"context_line":"    with open(hostnames_ip_file, \u0027wb\u0027) as f:"},{"line_number":190,"context_line":"        f.write("},{"line_number":191,"context_line":"            \u0027# This file is managed by openstack-ansible. No manual edits.\\n\u0027 +"},{"line_number":192,"context_line":"            json.dumps("},{"line_number":193,"context_line":"                hostnames_ips,"},{"line_number":194,"context_line":"                indent\u003d4,"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa0c359_d43215f2","line":191,"in_reply_to":"3fa0c359_937a7921","updated":"2018-02-26 09:06:17.000000000","message":"Yes, that is correct JSON does not allow for comments, but YAML does.\nAlso YAML is a superset of JSON, so any valid JSON is valid YAML (that\u0027s why json.dumps generates valid YAML and adding a comment is still valid YAML).\n\nA situation where this could cause problem is if openstack_hostnames_ips.yml is supposed to be JSON and not YAML, in which case the file extension is somewhat misleading.","commit_id":"b45623758761e38d3936fe2274b69eee9b964e5b"},{"author":{"_account_id":7219,"name":"git-harry","email":"git-harry@live.co.uk","username":"git-harry"},"change_message_id":"11a8110aadaba78294544e1c09f30e6994828959","unresolved":false,"context_lines":[{"line_number":188,"context_line":""},{"line_number":189,"context_line":"    with open(hostnames_ip_file, \u0027wb\u0027) as f:"},{"line_number":190,"context_line":"        f.write("},{"line_number":191,"context_line":"            \u0027# This file is managed by openstack-ansible. No manual edits.\\n\u0027 +"},{"line_number":192,"context_line":"            json.dumps("},{"line_number":193,"context_line":"                hostnames_ips,"},{"line_number":194,"context_line":"                indent\u003d4,"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa0c359_34c25986","line":191,"in_reply_to":"3fa0c359_d43215f2","updated":"2018-02-26 09:32:48.000000000","message":"Apologies, my mistake, I didn\u0027t actually look at the filename. The use of the json library caught me out.\n\nYou will need to adjust this though because it is actually causing the tests to give a false positive, the change needs to be compatible with Python3. Adding `.encode(\"ascii\")` should do the trick.","commit_id":"b45623758761e38d3936fe2274b69eee9b964e5b"}]}
