)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6486,"name":"Brant Knudson","email":"blk@acm.org","username":"blk-u"},"change_message_id":"34a3c78256f6be805473cb66644f4eb7a2a1dd15","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Rename instead of writing directly to revoked file"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Make the operation more atomic with multiple writters."},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"Closes-Bug: 1261554"},{"line_number":12,"context_line":"Change-Id: I990a2ba28d9a2a1d01300dcd33266956d059afa3"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"AAAATn%2F80M8%3D","line":9,"updated":"2013-12-20 01:35:58.000000000","message":"(spelling) change \"writters\" to \"writers\"","commit_id":"97dd8fc1d1d77fb3d2699ba2fbed0982fd897b91"}],"keystoneclient/middleware/auth_token.py":[{"author":{"_account_id":1,"name":"James E. Blair","email":"jim@acmegating.com","username":"corvus"},"change_message_id":"0c84e5662da0c63e48c8e0b4e52c19c78492e16a","unresolved":false,"context_lines":[{"line_number":1242,"context_line":"        self._token_revocation_list \u003d jsonutils.loads(value)"},{"line_number":1243,"context_line":"        self.token_revocation_list_fetched_time \u003d timeutils.utcnow()"},{"line_number":1244,"context_line":""},{"line_number":1245,"context_line":"        fd, file_name \u003d tempfile.mkstemp()"},{"line_number":1246,"context_line":"        os.write(fd, value)"},{"line_number":1247,"context_line":"        os.fsync(fd)"},{"line_number":1248,"context_line":"        os.rename(file_name, self.revoked_file_name)"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F811c%3D","line":1245,"updated":"2013-12-19 17:02:38.000000000","message":"You should specify the \u0027dir\u0027 argument to mkstemp to be the directory that the revocation file lives in, that way we are certain it will be on the same filesystem (rename will probably fail if they are not on the same fs).  [-1 vote due to this]","commit_id":"ee6286a2fd996931f291221fbe9328f891fc56a8"},{"author":{"_account_id":1,"name":"James E. Blair","email":"jim@acmegating.com","username":"corvus"},"change_message_id":"0c84e5662da0c63e48c8e0b4e52c19c78492e16a","unresolved":false,"context_lines":[{"line_number":1244,"context_line":""},{"line_number":1245,"context_line":"        fd, file_name \u003d tempfile.mkstemp()"},{"line_number":1246,"context_line":"        os.write(fd, value)"},{"line_number":1247,"context_line":"        os.fsync(fd)"},{"line_number":1248,"context_line":"        os.rename(file_name, self.revoked_file_name)"},{"line_number":1249,"context_line":""},{"line_number":1250,"context_line":"    def fetch_revocation_list(self, retry\u003dTrue):"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F812E%3D","line":1247,"updated":"2013-12-19 17:02:38.000000000","message":"You can close the file here -- mkstemp does not automatically delete the file so it will still exist.\n\nI don\u0027t believe the sync is necessary; it\u0027s true that the data may not be written to disk, but I believe that if another process opens the file, it would still get the correct data (cached in the kernel\u0027s memory).  Though it\u0027s possible this may come into play if the operating system halts before the data are completely written to disk.","commit_id":"ee6286a2fd996931f291221fbe9328f891fc56a8"},{"author":{"_account_id":6486,"name":"Brant Knudson","email":"blk@acm.org","username":"blk-u"},"change_message_id":"34a3c78256f6be805473cb66644f4eb7a2a1dd15","unresolved":false,"context_lines":[{"line_number":1244,"context_line":""},{"line_number":1245,"context_line":"        fd, file_name \u003d tempfile.mkstemp(dir\u003dself.signing_dirname)"},{"line_number":1246,"context_line":"        os.write(fd, value)"},{"line_number":1247,"context_line":"        os.close(fd)"},{"line_number":1248,"context_line":"        os.rename(file_name, self.revoked_file_name)"},{"line_number":1249,"context_line":""},{"line_number":1250,"context_line":"    def fetch_revocation_list(self, retry\u003dTrue):"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAATn%2F80Kw%3D","line":1247,"updated":"2013-12-20 01:35:58.000000000","message":"this should really be in a try/catch so the fd is always closed even if there\u0027s an exception during os.write().\n\nYou should be able to use NamedTemporaryFile in a with to do the close automatically: http://docs.python.org/2/library/tempfile.html#tempfile.NamedTemporaryFile\n\n with tempfile.NamedTemporaryFile(dir\u003dself.signing_dirname,delete\u003dFalse) as f:\n    f.write(value)\n\n os.rename(f.name, self.revoked_file_name)","commit_id":"97dd8fc1d1d77fb3d2699ba2fbed0982fd897b91"}]}
