)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"af44d7bde80a22e58a6c0b7ac12d54ab04afac2a","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Gerrit Code Review \u003creview@openstack.org\u003e"},{"line_number":5,"context_line":"CommitDate: 2013-10-25 13:37:44 +0000"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Redirect the stdout and stderr when using subpross"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Redirect the stdout and stderr to PIPE"},{"line_number":10,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"AAAATn%2F%2FALo%3D","line":7,"updated":"2013-11-15 21:15:25.000000000","message":"subpross -\u003e subprocess","commit_id":"31539f700cd8d40d2aae400c801d1e5d2657765d"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"af44d7bde80a22e58a6c0b7ac12d54ab04afac2a","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Redirect the stdout and stderr when using subpross"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Redirect the stdout and stderr to PIPE"},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"Closes-Bug: #1183526"},{"line_number":12,"context_line":"Change-Id: I37fc99e0f857d21ddd02b15234a42fec5810bc03"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"AAAATn%2F%2FALs%3D","line":9,"updated":"2013-11-15 21:15:25.000000000","message":"Suggest using either this line or the one above. Use this section as a place to explain *why* you want to us subprocess.","commit_id":"31539f700cd8d40d2aae400c801d1e5d2657765d"},{"author":{"_account_id":6482,"name":"Steve Martinelli","email":"s.martinelli@gmail.com","username":"stevemar"},"change_message_id":"bf9b6c21404efba280f12103a210dda1f10e88f1","unresolved":false,"context_lines":[{"line_number":11,"context_line":"streams and logs them in debug mode and when an exception is raised."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"Closes-Bug: #1183526"},{"line_number":14,"context_line":"Co-Authored-By: David Stanek\u003cdstanek@dstanek.com\u003e"},{"line_number":15,"context_line":"Change-Id: I37fc99e0f857d21ddd02b15234a42fec5810bc03"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":26,"id":"baada198_6ab315ec","line":14,"updated":"2014-08-11 04:10:38.000000000","message":"add a space between Stanek and \u003c\n\n  Co-Authored-By: David Stanek \u003cdstanek@dstanek.com\u003e\n\nOtherwise it won\u0027t recognize him","commit_id":"c61621ea471228d7729e9615800f519c965922a9"},{"author":{"_account_id":7488,"name":"Jeffrey Zhang","email":"zhang.lei.fly@gmail.com","username":"Jeffrey4l"},"change_message_id":"c8b00c135dc8a1703c116ed4b6bcd381558d94bf","unresolved":false,"context_lines":[{"line_number":11,"context_line":"streams and logs them in debug mode and when an exception is raised."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"Closes-Bug: #1183526"},{"line_number":14,"context_line":"Co-Authored-By: David Stanek\u003cdstanek@dstanek.com\u003e"},{"line_number":15,"context_line":"Change-Id: I37fc99e0f857d21ddd02b15234a42fec5810bc03"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":26,"id":"baada198_4abad1ba","line":14,"in_reply_to":"baada198_6ab315ec","updated":"2014-08-11 04:12:08.000000000","message":"Done","commit_id":"c61621ea471228d7729e9615800f519c965922a9"}],"keystone/common/openssl.py":[{"author":{"_account_id":7725,"name":"David Stanek","email":"dstanek@dstanek.com","username":"dstanek"},"change_message_id":"afc15c7f8a7a7bd3a30bf9cde012a2d3980491b8","unresolved":false,"context_lines":[{"line_number":75,"context_line":"    def exec_command(self, command):"},{"line_number":76,"context_line":"        to_exec \u003d command % self.ssl_dictionary"},{"line_number":77,"context_line":"        LOG.info(to_exec)"},{"line_number":78,"context_line":"        with open(os.path.devnull) as null_dev:"},{"line_number":79,"context_line":"            environment.subprocess.check_call(to_exec.rsplit(\u0027 \u0027),"},{"line_number":80,"context_line":"                                              stdout\u003dnull_dev,"},{"line_number":81,"context_line":"                                              stderr\u003dnull_dev)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAATH%2F%2FjTM%3D","line":78,"updated":"2013-10-14 16:24:49.000000000","message":"I don\u0027t believe that os.path.devnull exists in Python 2.6.  os.devnull should so you should be able to a less elegant, but workable solution.","commit_id":"ad123e9c05a2aa7d11dbfde8580ead776330efb2"},{"author":{"_account_id":7488,"name":"Jeffrey Zhang","email":"zhang.lei.fly@gmail.com","username":"Jeffrey4l"},"change_message_id":"ca98297ad5a9f6fcb145452a911b400bf086d280","unresolved":false,"context_lines":[{"line_number":75,"context_line":"    def exec_command(self, command):"},{"line_number":76,"context_line":"        to_exec \u003d command % self.ssl_dictionary"},{"line_number":77,"context_line":"        LOG.info(to_exec)"},{"line_number":78,"context_line":"        with open(os.path.devnull) as null_dev:"},{"line_number":79,"context_line":"            environment.subprocess.check_call(to_exec.rsplit(\u0027 \u0027),"},{"line_number":80,"context_line":"                                              stdout\u003dnull_dev,"},{"line_number":81,"context_line":"                                              stderr\u003dnull_dev)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAATH%2F%2Fha8%3D","line":78,"in_reply_to":"AAAATH%2F%2FjTM%3D","updated":"2013-10-16 01:31:59.000000000","message":"I doesn\u0027t found the resource about os.path.devnull. But I found [1] there is os.devnull exist from python 2.4. I will change to this variable. \n\nPS: New discovery, the os.devnull come from os.path.devnull [2]. So no change is needed.\n\n[1] http://stackoverflow.com/questions/2929899/cross-platform-dev-null-in-python\n\n[2] http://svn.python.org/projects/python/trunk/Lib/os.py","commit_id":"ad123e9c05a2aa7d11dbfde8580ead776330efb2"},{"author":{"_account_id":7725,"name":"David Stanek","email":"dstanek@dstanek.com","username":"dstanek"},"change_message_id":"23863553757c3455f6853f20d35dab03a0b084b3","unresolved":false,"context_lines":[{"line_number":76,"context_line":"        to_exec \u003d command % self.ssl_dictionary"},{"line_number":77,"context_line":"        LOG.info(to_exec)"},{"line_number":78,"context_line":"        environment.subprocess.check_call(to_exec.rsplit(\u0027 \u0027),"},{"line_number":79,"context_line":"                                          stdout\u003denvironment.subprocess.PIPE,"},{"line_number":80,"context_line":"                                          stderr\u003denvironment.subprocess.PIPE)"},{"line_number":81,"context_line":""},{"line_number":82,"context_line":"    def build_ssl_config_file(self):"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAATH%2F%2FSFs%3D","line":79,"updated":"2013-10-18 13:23:19.000000000","message":"According to the documentation[1] this can be a little dangerous.  I don\u0027t have a ton of experience using subprocess beyond trivail script so I can\u0027t offer too much here.\n\nIf I was writing this I may use check_output (redirecting stderr to stdout).  This way you could do something like:\n\ntry:\n    check_call(..., stderr\u003dSTDOUT)\nexcept CalledProcessError as e:\n    LOG.error(\u0027SSL command failed: %s\u0027, e.output)\n    raise","commit_id":"f3abe5966cb199b0ff3003be6c89b864904f48fc"},{"author":{"_account_id":7488,"name":"Jeffrey Zhang","email":"zhang.lei.fly@gmail.com","username":"Jeffrey4l"},"change_message_id":"ba771b71c0b01efee51f21f413319a2de4ccd92c","unresolved":false,"context_lines":[{"line_number":76,"context_line":"        to_exec \u003d command % self.ssl_dictionary"},{"line_number":77,"context_line":"        LOG.info(to_exec)"},{"line_number":78,"context_line":"        environment.subprocess.check_call(to_exec.rsplit(\u0027 \u0027),"},{"line_number":79,"context_line":"                                          stdout\u003denvironment.subprocess.PIPE,"},{"line_number":80,"context_line":"                                          stderr\u003denvironment.subprocess.PIPE)"},{"line_number":81,"context_line":""},{"line_number":82,"context_line":"    def build_ssl_config_file(self):"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAATn%2F%2F6I0%3D","line":79,"in_reply_to":"AAAATH%2F%2FSFs%3D","updated":"2013-10-25 12:40:51.000000000","message":"Yes. According the document, using PIPE to check_all may be dangerous. But your solution didn\u0027t solve the stdout problem. \n\nI will use another way to fix this.","commit_id":"f3abe5966cb199b0ff3003be6c89b864904f48fc"},{"author":{"_account_id":4,"name":"Dolph Mathews","email":"dolph.mathews@gmail.com","username":"dolph"},"change_message_id":"77bd20e571aec204278e14501ccb86ce6a15de77","unresolved":false,"context_lines":[{"line_number":84,"context_line":"        if retcode:"},{"line_number":85,"context_line":"            raise environment.subprocess.CalledProcessError(retcode,"},{"line_number":86,"context_line":"                                                            to_exec,"},{"line_number":87,"context_line":"                                                            output\u003derr)"},{"line_number":88,"context_line":""},{"line_number":89,"context_line":"    def build_ssl_config_file(self):"},{"line_number":90,"context_line":"        utils.make_dirs(os.path.dirname(self.ssl_config_file_name),"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATn%2F%2FJYw%3D","line":87,"updated":"2013-11-13 20:01:50.000000000","message":"this is just re-implementing check_call? you can pass stdout \u0026 stderr to check_call already","commit_id":"31539f700cd8d40d2aae400c801d1e5d2657765d"},{"author":{"_account_id":7488,"name":"Jeffrey Zhang","email":"zhang.lei.fly@gmail.com","username":"Jeffrey4l"},"change_message_id":"501428f3a535db684348a465191b043a65439e1e","unresolved":false,"context_lines":[{"line_number":84,"context_line":"        if retcode:"},{"line_number":85,"context_line":"            raise environment.subprocess.CalledProcessError(retcode,"},{"line_number":86,"context_line":"                                                            to_exec,"},{"line_number":87,"context_line":"                                                            output\u003derr)"},{"line_number":88,"context_line":""},{"line_number":89,"context_line":"    def build_ssl_config_file(self):"},{"line_number":90,"context_line":"        utils.make_dirs(os.path.dirname(self.ssl_config_file_name),"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATn%2F%2FHU0%3D","line":87,"in_reply_to":"AAAATn%2F%2FJYw%3D","updated":"2013-11-14 09:13:35.000000000","message":"Redirect the subprocess\u0027s stdout \u0026 stderr to PIPE is what I want to do to fix bug.\n\n----\n\nThere are risk mentioned by David Stanek[1]. You can found the official explanation from [2] and [3]. The root cause is the `wait` method, which is used by `check_all`. \n\nSo I use `communicate`.\n\n[1] https://review.openstack.org/#/c/51610/4/keystone/common/openssl.py\n\n[2] http://docs.python.org/2.7/library/subprocess.html#subprocess.check_call\n\n[3] http://docs.python.org/2.7/library/subprocess.html#subprocess.Popen.wait","commit_id":"31539f700cd8d40d2aae400c801d1e5d2657765d"},{"author":{"_account_id":7488,"name":"Jeffrey Zhang","email":"zhang.lei.fly@gmail.com","username":"Jeffrey4l"},"change_message_id":"1f9f3747145ba9ad50ec484f09922ecff63a630d","unresolved":false,"context_lines":[{"line_number":84,"context_line":"        if retcode:"},{"line_number":85,"context_line":"            LOG.error(_(\u0027command exited with %(retcode)s - %(output)s\u0027),"},{"line_number":86,"context_line":"                      {\u0027retcode\u0027: retcode, \u0027output\u0027: output})"},{"line_number":87,"context_line":"            raise subprocess.CalledProcessError(retcode, to_exec[0])"},{"line_number":88,"context_line":""},{"line_number":89,"context_line":"    def build_ssl_config_file(self):"},{"line_number":90,"context_line":"        utils.make_dirs(os.path.dirname(self.ssl_config_file_name),"}],"source_content_type":"text/x-python","patch_set":12,"id":"AAAATn%2F%2BzCw%3D","line":87,"updated":"2013-11-20 03:29:28.000000000","message":"May need some work around for the compatible with python 2.6.","commit_id":"f62c61357cdbd0115c24c9306436759a2da65ff1"},{"author":{"_account_id":6486,"name":"Brant Knudson","email":"blk@acm.org","username":"blk-u"},"change_message_id":"331315b2e3da6e2b9dea787958234d42a9d83702","unresolved":false,"context_lines":[{"line_number":77,"context_line":"        LOG.info(_(\u0027running command - %s\u0027), to_exec)"},{"line_number":78,"context_line":"        to_exec \u003d to_exec.split(\u0027 \u0027)"},{"line_number":79,"context_line":""},{"line_number":80,"context_line":"        process \u003d environment.subprocess.Popen("},{"line_number":81,"context_line":"            to_exec,"},{"line_number":82,"context_line":"            stdout\u003denvironment.subprocess.PIPE,"},{"line_number":83,"context_line":"            stderr\u003denvironment.subprocess.STDOUT)"}],"source_content_type":"text/x-python","patch_set":17,"id":"AAAATn%2F9G%2Fo%3D","line":80,"updated":"2013-12-16 18:08:48.000000000","message":"I don\u0027t understand why we have to change from check_call to Popen? check_call takes stdout and stderr options. The docs recommend to use check_call, etc, if possible: http://docs.python.org/2/library/subprocess.html#using-the-subprocess-module","commit_id":"50510af50780bc96c07068bb1c6b6783ae5cf757"},{"author":{"_account_id":6486,"name":"Brant Knudson","email":"blk@acm.org","username":"blk-u"},"change_message_id":"8da3b03b389b7cd877fad22ae759e73f81dca817","unresolved":false,"context_lines":[{"line_number":77,"context_line":"        LOG.info(_(\u0027running command - %s\u0027), to_exec)"},{"line_number":78,"context_line":"        to_exec \u003d to_exec.split(\u0027 \u0027)"},{"line_number":79,"context_line":""},{"line_number":80,"context_line":"        process \u003d environment.subprocess.Popen("},{"line_number":81,"context_line":"            to_exec,"},{"line_number":82,"context_line":"            stdout\u003denvironment.subprocess.PIPE,"},{"line_number":83,"context_line":"            stderr\u003denvironment.subprocess.STDOUT)"}],"source_content_type":"text/x-python","patch_set":17,"id":"AAAATn%2F859U%3D","line":80,"in_reply_to":"AAAATn%2F9EcQ%3D","updated":"2013-12-18 23:31:17.000000000","message":"What about check_output? http://docs.python.org/2/library/subprocess.html#subprocess.check_output\n\nthat one doesn\u0027t say \"Do not use stdout\u003dPIPE\", probably because there\u0027s no stdout argument, and it also says \"use stderr\u003dsubprocess.STDOUT\" which this is doing.","commit_id":"50510af50780bc96c07068bb1c6b6783ae5cf757"},{"author":{"_account_id":7725,"name":"David Stanek","email":"dstanek@dstanek.com","username":"dstanek"},"change_message_id":"f3f51af1cf671487455ff88a4c891f8c7bcd16f6","unresolved":false,"context_lines":[{"line_number":77,"context_line":"        LOG.info(_(\u0027running command - %s\u0027), to_exec)"},{"line_number":78,"context_line":"        to_exec \u003d to_exec.split(\u0027 \u0027)"},{"line_number":79,"context_line":""},{"line_number":80,"context_line":"        process \u003d environment.subprocess.Popen("},{"line_number":81,"context_line":"            to_exec,"},{"line_number":82,"context_line":"            stdout\u003denvironment.subprocess.PIPE,"},{"line_number":83,"context_line":"            stderr\u003denvironment.subprocess.STDOUT)"}],"source_content_type":"text/x-python","patch_set":17,"id":"AAAATn%2F9EcQ%3D","line":80,"in_reply_to":"AAAATn%2F9G%2Fo%3D","updated":"2013-12-17 04:04:24.000000000","message":"The author\u0027s goal was to use PIPE to stop spewing output.  In the check_call section of that link there is a note saying not to use PIPE with check_call.","commit_id":"50510af50780bc96c07068bb1c6b6783ae5cf757"},{"author":{"_account_id":4,"name":"Dolph Mathews","email":"dolph.mathews@gmail.com","username":"dolph"},"change_message_id":"ef5d79a1564639811b73fd833fc5bb46efa4b616","unresolved":false,"context_lines":[{"line_number":80,"context_line":"            to_exec,"},{"line_number":81,"context_line":"            stdout\u003denvironment.subprocess.PIPE,"},{"line_number":82,"context_line":"            stderr\u003denvironment.subprocess.STDOUT)"},{"line_number":83,"context_line":"        output \u003d process.communicate()[0]"},{"line_number":84,"context_line":"        retcode \u003d process.poll()"},{"line_number":85,"context_line":"        if retcode:"},{"line_number":86,"context_line":"            LOG.error(_(\u0027command exited with %(retcode)s - %(output)s\u0027),"}],"source_content_type":"text/x-python","patch_set":19,"id":"baada198_0e1c8d65","line":83,"updated":"2014-07-24 22:03:13.000000000","message":"an inline comment would be appreciated, because it took me a minute to understand this. AFAICT, you\u0027re setting stdout to pipe, and stderr to stdout, and then capturing stdout here as output (and ignoring stderr since it was combined anyway). is that correct?","commit_id":"2049695ac137fb852741ee9cc17140783d78900e"},{"author":{"_account_id":2903,"name":"Morgan Fainberg","email":"morgan.fainberg@gmail.com","username":"mdrnstm"},"change_message_id":"6404accac67b30762feffed70fc88c9926923057","unresolved":false,"context_lines":[{"line_number":80,"context_line":"            to_exec,"},{"line_number":81,"context_line":"            stdout\u003denvironment.subprocess.PIPE,"},{"line_number":82,"context_line":"            stderr\u003denvironment.subprocess.STDOUT)"},{"line_number":83,"context_line":"        output \u003d process.communicate()[0]"},{"line_number":84,"context_line":"        retcode \u003d process.poll()"},{"line_number":85,"context_line":"        if retcode:"},{"line_number":86,"context_line":"            LOG.error(_(\u0027command exited with %(retcode)s - %(output)s\u0027),"}],"source_content_type":"text/x-python","patch_set":19,"id":"baada198_aeeac19d","line":83,"in_reply_to":"baada198_0e1c8d65","updated":"2014-07-24 22:19:31.000000000","message":"++ a comment here would help *a lot*","commit_id":"2049695ac137fb852741ee9cc17140783d78900e"},{"author":{"_account_id":1916,"name":"Guang Yee","email":"gyee@suse.com","username":"guang-yee"},"change_message_id":"8778a180b5777f19f0f887af350506a4ec2eabd1","unresolved":false,"context_lines":[{"line_number":75,"context_line":"        to_exec \u003d []"},{"line_number":76,"context_line":"        for cmd_part in command:"},{"line_number":77,"context_line":"            to_exec.append(cmd_part % self.ssl_dictionary)"},{"line_number":78,"context_line":"        LOG.info(_(\u0027running command - %s\u0027), \u0027 \u0027.join(to_exec))"},{"line_number":79,"context_line":"        # NOTE(Jeffrey4l): Redirect both stdout and stderr to pipe, so the"},{"line_number":80,"context_line":"        # output can be captured."},{"line_number":81,"context_line":"        process \u003d environment.subprocess.Popen("}],"source_content_type":"text/x-python","patch_set":22,"id":"baada198_3bbe8a64","line":78,"updated":"2014-08-05 06:09:43.000000000","message":"That may log the token as well. I don\u0027t think the security folks like that.","commit_id":"b46d11f29ea893543b23d36bad920a6386eb9498"},{"author":{"_account_id":6486,"name":"Brant Knudson","email":"blk@acm.org","username":"blk-u"},"change_message_id":"c0ecca1b005ea24a35431531d8b801e2f2fc08ce","unresolved":false,"context_lines":[{"line_number":75,"context_line":"        to_exec \u003d []"},{"line_number":76,"context_line":"        for cmd_part in command:"},{"line_number":77,"context_line":"            to_exec.append(cmd_part % self.ssl_dictionary)"},{"line_number":78,"context_line":"        LOG.info(_(\u0027running command - %s\u0027), \u0027 \u0027.join(to_exec))"},{"line_number":79,"context_line":"        # NOTE(Jeffrey4l): Redirect both stdout and stderr to pipe, so the"},{"line_number":80,"context_line":"        # output can be captured."},{"line_number":81,"context_line":"        process \u003d environment.subprocess.Popen("}],"source_content_type":"text/x-python","patch_set":23,"id":"baada198_760d5392","line":78,"updated":"2014-08-05 23:22:44.000000000","message":"This should use _LI rather than _","commit_id":"52bc369d0d8af2ba3b87fe05328890ee3474668c"},{"author":{"_account_id":7488,"name":"Jeffrey Zhang","email":"zhang.lei.fly@gmail.com","username":"Jeffrey4l"},"change_message_id":"bc9b305c63b1a24b6e7f7730e22b805520b408d6","unresolved":false,"context_lines":[{"line_number":75,"context_line":"        to_exec \u003d []"},{"line_number":76,"context_line":"        for cmd_part in command:"},{"line_number":77,"context_line":"            to_exec.append(cmd_part % self.ssl_dictionary)"},{"line_number":78,"context_line":"        LOG.info(_(\u0027running command - %s\u0027), \u0027 \u0027.join(to_exec))"},{"line_number":79,"context_line":"        # NOTE(Jeffrey4l): Redirect both stdout and stderr to pipe, so the"},{"line_number":80,"context_line":"        # output can be captured."},{"line_number":81,"context_line":"        process \u003d environment.subprocess.Popen("}],"source_content_type":"text/x-python","patch_set":23,"id":"baada198_d9c53a3f","line":78,"in_reply_to":"baada198_760d5392","updated":"2014-08-07 13:40:48.000000000","message":"Done","commit_id":"52bc369d0d8af2ba3b87fe05328890ee3474668c"},{"author":{"_account_id":6486,"name":"Brant Knudson","email":"blk@acm.org","username":"blk-u"},"change_message_id":"c0ecca1b005ea24a35431531d8b801e2f2fc08ce","unresolved":false,"context_lines":[{"line_number":78,"context_line":"        LOG.info(_(\u0027running command - %s\u0027), \u0027 \u0027.join(to_exec))"},{"line_number":79,"context_line":"        # NOTE(Jeffrey4l): Redirect both stdout and stderr to pipe, so the"},{"line_number":80,"context_line":"        # output can be captured."},{"line_number":81,"context_line":"        process \u003d environment.subprocess.Popen("},{"line_number":82,"context_line":"            to_exec,"},{"line_number":83,"context_line":"            stdout\u003denvironment.subprocess.PIPE,"},{"line_number":84,"context_line":"            stderr\u003denvironment.subprocess.STDOUT)"}],"source_content_type":"text/x-python","patch_set":23,"id":"baada198_765b9389","line":81,"updated":"2014-08-05 23:22:44.000000000","message":"use subprocess.check_output.","commit_id":"52bc369d0d8af2ba3b87fe05328890ee3474668c"},{"author":{"_account_id":7488,"name":"Jeffrey Zhang","email":"zhang.lei.fly@gmail.com","username":"Jeffrey4l"},"change_message_id":"bc9b305c63b1a24b6e7f7730e22b805520b408d6","unresolved":false,"context_lines":[{"line_number":78,"context_line":"        LOG.info(_(\u0027running command - %s\u0027), \u0027 \u0027.join(to_exec))"},{"line_number":79,"context_line":"        # NOTE(Jeffrey4l): Redirect both stdout and stderr to pipe, so the"},{"line_number":80,"context_line":"        # output can be captured."},{"line_number":81,"context_line":"        process \u003d environment.subprocess.Popen("},{"line_number":82,"context_line":"            to_exec,"},{"line_number":83,"context_line":"            stdout\u003denvironment.subprocess.PIPE,"},{"line_number":84,"context_line":"            stderr\u003denvironment.subprocess.STDOUT)"}],"source_content_type":"text/x-python","patch_set":23,"id":"baada198_b998866a","line":81,"in_reply_to":"baada198_765b9389","updated":"2014-08-07 13:40:48.000000000","message":"subprocess.check_output is add in python 2.7[1]. But I think we should compatible with python 2.6.\n[1] https://docs.python.org/2/library/subprocess.html#subprocess.check_output","commit_id":"52bc369d0d8af2ba3b87fe05328890ee3474668c"},{"author":{"_account_id":6486,"name":"Brant Knudson","email":"blk@acm.org","username":"blk-u"},"change_message_id":"79fc0026de81d4bb53b1f91b9de077d8e82e165f","unresolved":false,"context_lines":[{"line_number":78,"context_line":"        LOG.info(_LI(\u0027running command - %s\u0027), \u0027 \u0027.join(to_exec))"},{"line_number":79,"context_line":"        # NOTE(Jeffrey4l): Redirect both stdout and stderr to pipe, so the"},{"line_number":80,"context_line":"        # output can be captured."},{"line_number":81,"context_line":"        process \u003d environment.subprocess.Popen("},{"line_number":82,"context_line":"            to_exec,"},{"line_number":83,"context_line":"            stdout\u003denvironment.subprocess.PIPE,"},{"line_number":84,"context_line":"            stderr\u003denvironment.subprocess.STDOUT)"}],"source_content_type":"text/x-python","patch_set":25,"id":"baada198_d984245f","line":81,"updated":"2014-08-08 15:05:42.000000000","message":"Add a comment why check_output isn\u0027t used.","commit_id":"a9ac93e10b6b086b782b69b7f2b454697262787e"},{"author":{"_account_id":7488,"name":"Jeffrey Zhang","email":"zhang.lei.fly@gmail.com","username":"Jeffrey4l"},"change_message_id":"60ce6e14d3992caeb80e7ebf96392443cda9eb19","unresolved":false,"context_lines":[{"line_number":78,"context_line":"        LOG.info(_LI(\u0027running command - %s\u0027), \u0027 \u0027.join(to_exec))"},{"line_number":79,"context_line":"        # NOTE(Jeffrey4l): Redirect both stdout and stderr to pipe, so the"},{"line_number":80,"context_line":"        # output can be captured."},{"line_number":81,"context_line":"        process \u003d environment.subprocess.Popen("},{"line_number":82,"context_line":"            to_exec,"},{"line_number":83,"context_line":"            stdout\u003denvironment.subprocess.PIPE,"},{"line_number":84,"context_line":"            stderr\u003denvironment.subprocess.STDOUT)"}],"source_content_type":"text/x-python","patch_set":25,"id":"baada198_ff78c52d","line":81,"in_reply_to":"baada198_d984245f","updated":"2014-08-11 03:30:33.000000000","message":"Done","commit_id":"a9ac93e10b6b086b782b69b7f2b454697262787e"},{"author":{"_account_id":6486,"name":"Brant Knudson","email":"blk@acm.org","username":"blk-u"},"change_message_id":"79fc0026de81d4bb53b1f91b9de077d8e82e165f","unresolved":false,"context_lines":[{"line_number":85,"context_line":"        output \u003d process.communicate()[0]"},{"line_number":86,"context_line":"        retcode \u003d process.poll()"},{"line_number":87,"context_line":"        if retcode:"},{"line_number":88,"context_line":"            LOG.error(_LE(\u0027command exited with %(retcode)s - %(output)s\u0027),"},{"line_number":89,"context_line":"                      {\u0027retcode\u0027: retcode, \u0027output\u0027: output})"},{"line_number":90,"context_line":"            e \u003d environment.subprocess.CalledProcessError(retcode, to_exec[0])"},{"line_number":91,"context_line":"            # NOTE(Jeffrey4l): Python 2.6 compatibility:"}],"source_content_type":"text/x-python","patch_set":25,"id":"baada198_190e9ce4","line":88,"updated":"2014-08-08 15:05:42.000000000","message":"this should say what the command was. it was logged at 78 but that was at info level and this is at error level.","commit_id":"a9ac93e10b6b086b782b69b7f2b454697262787e"},{"author":{"_account_id":7488,"name":"Jeffrey Zhang","email":"zhang.lei.fly@gmail.com","username":"Jeffrey4l"},"change_message_id":"60ce6e14d3992caeb80e7ebf96392443cda9eb19","unresolved":false,"context_lines":[{"line_number":85,"context_line":"        output \u003d process.communicate()[0]"},{"line_number":86,"context_line":"        retcode \u003d process.poll()"},{"line_number":87,"context_line":"        if retcode:"},{"line_number":88,"context_line":"            LOG.error(_LE(\u0027command exited with %(retcode)s - %(output)s\u0027),"},{"line_number":89,"context_line":"                      {\u0027retcode\u0027: retcode, \u0027output\u0027: output})"},{"line_number":90,"context_line":"            e \u003d environment.subprocess.CalledProcessError(retcode, to_exec[0])"},{"line_number":91,"context_line":"            # NOTE(Jeffrey4l): Python 2.6 compatibility:"}],"source_content_type":"text/x-python","patch_set":25,"id":"baada198_3fd4fde8","line":88,"in_reply_to":"baada198_190e9ce4","updated":"2014-08-11 03:30:33.000000000","message":"Done","commit_id":"a9ac93e10b6b086b782b69b7f2b454697262787e"},{"author":{"_account_id":6486,"name":"Brant Knudson","email":"blk@acm.org","username":"blk-u"},"change_message_id":"42d8e57064acea9fa58a8505122567cabe4e6417","unresolved":false,"context_lines":[{"line_number":78,"context_line":"        LOG.info(_LI(\u0027Running command - %s\u0027), \u0027 \u0027.join(to_exec))"},{"line_number":79,"context_line":"        # NOTE(Jeffrey4l): Redirect both stdout and stderr to pipe, so the"},{"line_number":80,"context_line":"        # output can be captured."},{"line_number":81,"context_line":"        # NOTE(Jeffrey4l): check_output is not compatibility with Python 2.6."},{"line_number":82,"context_line":"        # So use Popen instead."},{"line_number":83,"context_line":"        process \u003d environment.subprocess.Popen("},{"line_number":84,"context_line":"            to_exec,"}],"source_content_type":"text/x-python","patch_set":27,"id":"7ac7a964_e360a337","line":81,"updated":"2014-08-15 01:31:27.000000000","message":"(nit) change \"compatibility to \"compatible\".","commit_id":"172a3899a96c200a0ff2a04954f7d449910de09e"}],"keystone/tests/test_cert_setup.py":[{"author":{"_account_id":7725,"name":"David Stanek","email":"dstanek@dstanek.com","username":"dstanek"},"change_message_id":"639513b94a62cd51fc40b8d28589da534f230e08","unresolved":false,"context_lines":[{"line_number":124,"context_line":"        try:"},{"line_number":125,"context_line":"            ssl.exec_command(cmd)"},{"line_number":126,"context_line":"        except subprocess.CalledProcessError as e:"},{"line_number":127,"context_line":"            self.assertEqual(e.output, output)"},{"line_number":128,"context_line":"        else:"},{"line_number":129,"context_line":"            self.fail()"}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAATn%2F%2By3E%3D","line":127,"updated":"2013-11-20 04:04:19.000000000","message":"Take a look at how I used assertRaises in patchset 10.  That removes the need for a try-except.","commit_id":"905070163ef65855e6e77d335f48d21b058f447e"},{"author":{"_account_id":7488,"name":"Jeffrey Zhang","email":"zhang.lei.fly@gmail.com","username":"Jeffrey4l"},"change_message_id":"ef4e6ba5402660d2418fbe5f556b8aac88e1bf01","unresolved":false,"context_lines":[{"line_number":124,"context_line":"        try:"},{"line_number":125,"context_line":"            ssl.exec_command(cmd)"},{"line_number":126,"context_line":"        except subprocess.CalledProcessError as e:"},{"line_number":127,"context_line":"            self.assertEqual(e.output, output)"},{"line_number":128,"context_line":"        else:"},{"line_number":129,"context_line":"            self.fail()"}],"source_content_type":"text/x-python","patch_set":13,"id":"AAAATn%2F%2By2Y%3D","line":127,"in_reply_to":"AAAATn%2F%2By3E%3D","updated":"2013-11-20 04:18:25.000000000","message":"Ths. Learn more.","commit_id":"905070163ef65855e6e77d335f48d21b058f447e"},{"author":{"_account_id":6486,"name":"Brant Knudson","email":"blk@acm.org","username":"blk-u"},"change_message_id":"331315b2e3da6e2b9dea787958234d42a9d83702","unresolved":false,"context_lines":[{"line_number":109,"context_line":"    def test_running_a_successful_command(self, mock_subprocess):"},{"line_number":110,"context_line":"        mock_subprocess.Popen().poll.return_value \u003d 0"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"        ssl \u003d openssl.ConfigureSSL(None, None)"},{"line_number":113,"context_line":"        ssl.exec_command(\u0027this command exits with a 0 status code\u0027)"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"    @mock.patch(\u0027keystone.common.openssl.environment.subprocess\u0027)"}],"source_content_type":"text/x-python","patch_set":17,"id":"AAAATn%2F9G%2FM%3D","line":112,"updated":"2013-12-16 18:08:48.000000000","message":"give names to the None parameters so we know what they are for.","commit_id":"50510af50780bc96c07068bb1c6b6783ae5cf757"},{"author":{"_account_id":11387,"name":"Sam Leong","email":"chio-fai-sam.leong@hpe.com","username":"Chioleong"},"change_message_id":"dc2ec3f3ad7cecb35b6ea318a808231cd8115e82","unresolved":false,"context_lines":[{"line_number":109,"context_line":"    def test_running_a_successful_command(self, mock_subprocess):"},{"line_number":110,"context_line":"        mock_subprocess.Popen().poll.return_value \u003d 0"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"        ssl \u003d openssl.ConfigureSSL(None, None)"},{"line_number":113,"context_line":"        ssl.exec_command(\u0027this command exits with a 0 status code\u0027)"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"    @mock.patch(\u0027keystone.common.openssl.environment.subprocess\u0027)"}],"source_content_type":"text/x-python","patch_set":17,"id":"baada198_10634ade","line":112,"in_reply_to":"AAAATn%2F9G%2FM%3D","updated":"2014-07-16 00:52:51.000000000","message":"yes, agree on that.","commit_id":"50510af50780bc96c07068bb1c6b6783ae5cf757"},{"author":{"_account_id":6486,"name":"Brant Knudson","email":"blk@acm.org","username":"blk-u"},"change_message_id":"331315b2e3da6e2b9dea787958234d42a9d83702","unresolved":false,"context_lines":[{"line_number":120,"context_line":"        mock_subprocess.Popen().poll.return_value \u003d 1"},{"line_number":121,"context_line":""},{"line_number":122,"context_line":"        cmd \u003d \u0027this command exits with a 1 status code and included output\u0027"},{"line_number":123,"context_line":"        ssl \u003d openssl.ConfigureSSL(None, None)"},{"line_number":124,"context_line":"        e \u003d self.assertRaises(subprocess.CalledProcessError,"},{"line_number":125,"context_line":"                              ssl.exec_command,"},{"line_number":126,"context_line":"                              cmd)"}],"source_content_type":"text/x-python","patch_set":17,"id":"AAAATn%2F9G%2FE%3D","line":123,"updated":"2013-12-16 18:08:48.000000000","message":"give names to the None parameters so we know what they are for.","commit_id":"50510af50780bc96c07068bb1c6b6783ae5cf757"},{"author":{"_account_id":6486,"name":"Brant Knudson","email":"blk@acm.org","username":"blk-u"},"change_message_id":"c0ecca1b005ea24a35431531d8b801e2f2fc08ce","unresolved":false,"context_lines":[{"line_number":143,"context_line":""},{"line_number":144,"context_line":"class TestExecCommand(tests.TestCase):"},{"line_number":145,"context_line":""},{"line_number":146,"context_line":"    @mock.patch(\u0027keystone.common.openssl.environment.subprocess\u0027)"},{"line_number":147,"context_line":"    def test_running_a_successful_command(self, mock_subprocess):"},{"line_number":148,"context_line":"        mock_subprocess.Popen().poll.return_value \u003d 0"},{"line_number":149,"context_line":""}],"source_content_type":"text/x-python","patch_set":23,"id":"baada198_16fa5744","line":146,"updated":"2014-08-05 23:22:44.000000000","message":"use mock.patch.object.","commit_id":"52bc369d0d8af2ba3b87fe05328890ee3474668c"},{"author":{"_account_id":7488,"name":"Jeffrey Zhang","email":"zhang.lei.fly@gmail.com","username":"Jeffrey4l"},"change_message_id":"bc9b305c63b1a24b6e7f7730e22b805520b408d6","unresolved":false,"context_lines":[{"line_number":143,"context_line":""},{"line_number":144,"context_line":"class TestExecCommand(tests.TestCase):"},{"line_number":145,"context_line":""},{"line_number":146,"context_line":"    @mock.patch(\u0027keystone.common.openssl.environment.subprocess\u0027)"},{"line_number":147,"context_line":"    def test_running_a_successful_command(self, mock_subprocess):"},{"line_number":148,"context_line":"        mock_subprocess.Popen().poll.return_value \u003d 0"},{"line_number":149,"context_line":""}],"source_content_type":"text/x-python","patch_set":23,"id":"baada198_dce9a1ac","line":146,"in_reply_to":"baada198_16fa5744","updated":"2014-08-07 13:40:48.000000000","message":"Done","commit_id":"52bc369d0d8af2ba3b87fe05328890ee3474668c"},{"author":{"_account_id":6486,"name":"Brant Knudson","email":"blk@acm.org","username":"blk-u"},"change_message_id":"c0ecca1b005ea24a35431531d8b801e2f2fc08ce","unresolved":false,"context_lines":[{"line_number":152,"context_line":""},{"line_number":153,"context_line":"    def test_running_an_invalid_command(self):"},{"line_number":154,"context_line":"        CalledProcessError \u003d environment.subprocess.CalledProcessError"},{"line_number":155,"context_line":"        with mock.patch(\u0027keystone.common.openssl.environment.subprocess\u0027) \\"},{"line_number":156,"context_line":"                as mock_subprocess:"},{"line_number":157,"context_line":"            output \u003d \u0027this is the output string\u0027"},{"line_number":158,"context_line":"            mock_subprocess.CalledProcessError \u003d CalledProcessError"}],"source_content_type":"text/x-python","patch_set":23,"id":"baada198_36f75b5c","line":155,"updated":"2014-08-05 23:22:44.000000000","message":"use mock.patch.object, also should be able to use the decorator like on the other method.","commit_id":"52bc369d0d8af2ba3b87fe05328890ee3474668c"},{"author":{"_account_id":7488,"name":"Jeffrey Zhang","email":"zhang.lei.fly@gmail.com","username":"Jeffrey4l"},"change_message_id":"bc9b305c63b1a24b6e7f7730e22b805520b408d6","unresolved":false,"context_lines":[{"line_number":152,"context_line":""},{"line_number":153,"context_line":"    def test_running_an_invalid_command(self):"},{"line_number":154,"context_line":"        CalledProcessError \u003d environment.subprocess.CalledProcessError"},{"line_number":155,"context_line":"        with mock.patch(\u0027keystone.common.openssl.environment.subprocess\u0027) \\"},{"line_number":156,"context_line":"                as mock_subprocess:"},{"line_number":157,"context_line":"            output \u003d \u0027this is the output string\u0027"},{"line_number":158,"context_line":"            mock_subprocess.CalledProcessError \u003d CalledProcessError"}],"source_content_type":"text/x-python","patch_set":23,"id":"baada198_1c2b19eb","line":155,"in_reply_to":"baada198_36f75b5c","updated":"2014-08-07 13:40:48.000000000","message":"Done","commit_id":"52bc369d0d8af2ba3b87fe05328890ee3474668c"}]}
