)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"386fa154e94e96f8449120db73b5022bbdb4071b","unresolved":false,"context_lines":[{"line_number":11,"context_line":"ironic-lib will execute commands with run_as_root\u003dFalse. This configuration"},{"line_number":12,"context_line":"is not set by default."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"This fix also delivers a smaple ironic-lib.filters file, which should be used"},{"line_number":15,"context_line":"with rootwrap command."},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"Change-Id: I61ef7c15237c995e9d4cc85095ac48a30a8f6c7d"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"ba8a016a_0cde24dd","line":14,"updated":"2015-11-18 14:48:01.000000000","message":"nit, s/smaple/sample/","commit_id":"dea7eab749f5d305a58ff2bf7831aef9487f0ec2"},{"author":{"_account_id":10574,"name":"Syed Ismail Faizan Barmawer","email":"faizan.barmawer@gmail.com","username":"barmawer"},"change_message_id":"ba1d9eb17c5b963f664cd8ecbf11a6f210a8376c","unresolved":false,"context_lines":[{"line_number":11,"context_line":"ironic-lib will execute commands with run_as_root\u003dFalse. This configuration"},{"line_number":12,"context_line":"is not set by default."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"This fix also delivers a smaple ironic-lib.filters file, which should be used"},{"line_number":15,"context_line":"with rootwrap command."},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"Change-Id: I61ef7c15237c995e9d4cc85095ac48a30a8f6c7d"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"ba8a016a_17428868","line":14,"in_reply_to":"ba8a016a_0cde24dd","updated":"2015-11-19 05:53:29.000000000","message":"Done","commit_id":"dea7eab749f5d305a58ff2bf7831aef9487f0ec2"}],"etc/rootwrap.d/ironic-lib.filters":[{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"48a4105a4b6003d99d2227e7aa787697b80280b5","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# A sample ironic-lib.filters to be used with specif rootwrap command."},{"line_number":2,"context_line":"# The following commands should be used in filters for disk manipulation"},{"line_number":3,"context_line":"# This file should be owned by (and only-writeable by) the root user"},{"line_number":4,"context_line":""}],"source_content_type":"application/octet-stream","patch_set":1,"id":"ba8a016a_2f7ca971","line":1,"updated":"2015-11-16 19:37:04.000000000","message":"typo: \u0027specif\u0027\n\nI wonder if we need to put \u0027sample\u0027. Presumably, users can just add this file to their rootwrap config path.","commit_id":"f9000484a9e310046ed93abff63b6a14aa01bd1b"},{"author":{"_account_id":10574,"name":"Syed Ismail Faizan Barmawer","email":"faizan.barmawer@gmail.com","username":"barmawer"},"change_message_id":"dad0eda45ab48958cda4f33ba02afdeb2b945e86","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# A sample ironic-lib.filters to be used with specif rootwrap command."},{"line_number":2,"context_line":"# The following commands should be used in filters for disk manipulation"},{"line_number":3,"context_line":"# This file should be owned by (and only-writeable by) the root user"},{"line_number":4,"context_line":""}],"source_content_type":"application/octet-stream","patch_set":1,"id":"ba8a016a_71f23971","line":1,"in_reply_to":"ba8a016a_2f7ca971","updated":"2015-11-18 13:08:20.000000000","message":"Done","commit_id":"f9000484a9e310046ed93abff63b6a14aa01bd1b"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"48a4105a4b6003d99d2227e7aa787697b80280b5","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# A sample ironic-lib.filters to be used with specif rootwrap command."},{"line_number":2,"context_line":"# The following commands should be used in filters for disk manipulation"},{"line_number":3,"context_line":"# This file should be owned by (and only-writeable by) the root user"},{"line_number":4,"context_line":""},{"line_number":5,"context_line":"[Filters]"},{"line_number":6,"context_line":"# ironic_lib/disk_utils.py"}],"source_content_type":"application/octet-stream","patch_set":1,"id":"ba8a016a_cf8ddd7c","line":3,"updated":"2015-11-16 19:37:04.000000000","message":"Should probably end the two sentences with periods.","commit_id":"f9000484a9e310046ed93abff63b6a14aa01bd1b"},{"author":{"_account_id":10574,"name":"Syed Ismail Faizan Barmawer","email":"faizan.barmawer@gmail.com","username":"barmawer"},"change_message_id":"dad0eda45ab48958cda4f33ba02afdeb2b945e86","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# A sample ironic-lib.filters to be used with specif rootwrap command."},{"line_number":2,"context_line":"# The following commands should be used in filters for disk manipulation"},{"line_number":3,"context_line":"# This file should be owned by (and only-writeable by) the root user"},{"line_number":4,"context_line":""},{"line_number":5,"context_line":"[Filters]"},{"line_number":6,"context_line":"# ironic_lib/disk_utils.py"}],"source_content_type":"application/octet-stream","patch_set":1,"id":"ba8a016a_91947de2","line":3,"in_reply_to":"ba8a016a_cf8ddd7c","updated":"2015-11-18 13:08:20.000000000","message":"Done","commit_id":"f9000484a9e310046ed93abff63b6a14aa01bd1b"}],"ironic_lib/tests/test_utils.py":[{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"386fa154e94e96f8449120db73b5022bbdb4071b","unresolved":false,"context_lines":[{"line_number":171,"context_line":"        CONF.set_override(\u0027root_helper\u0027, None, group\u003d\u0027ironic_lib\u0027)"},{"line_number":172,"context_line":"        with mock.patch.object(processutils, \u0027execute\u0027) as execute_mock:"},{"line_number":173,"context_line":"            utils.execute(\u0027foo\u0027, run_as_root\u003dFalse)"},{"line_number":174,"context_line":"            execute_mock.assert_called_once_with(\u0027foo\u0027, run_as_root\u003dFalse)"},{"line_number":175,"context_line":""},{"line_number":176,"context_line":"    def test_execute_with_root_helper(self):"},{"line_number":177,"context_line":"        CONF.set_override(\u0027root_helper\u0027, \u0027sudo\u0027, group\u003d\u0027ironic_lib\u0027)"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba8a016a_128cfa7d","line":174,"updated":"2015-11-18 14:48:01.000000000","message":"I would like to see a test with utils.execute(.., run_as_root\u003dTrue) but root_helper config is None. That should cause processutils.execute(.., run_as_root\u003dFalse).\n\n(Because the code in ironic-lib will call utils.execute(., run_as_root\u003dTrue) so we want to show that this change handles that case.)","commit_id":"dea7eab749f5d305a58ff2bf7831aef9487f0ec2"},{"author":{"_account_id":10574,"name":"Syed Ismail Faizan Barmawer","email":"faizan.barmawer@gmail.com","username":"barmawer"},"change_message_id":"ba1d9eb17c5b963f664cd8ecbf11a6f210a8376c","unresolved":false,"context_lines":[{"line_number":171,"context_line":"        CONF.set_override(\u0027root_helper\u0027, None, group\u003d\u0027ironic_lib\u0027)"},{"line_number":172,"context_line":"        with mock.patch.object(processutils, \u0027execute\u0027) as execute_mock:"},{"line_number":173,"context_line":"            utils.execute(\u0027foo\u0027, run_as_root\u003dFalse)"},{"line_number":174,"context_line":"            execute_mock.assert_called_once_with(\u0027foo\u0027, run_as_root\u003dFalse)"},{"line_number":175,"context_line":""},{"line_number":176,"context_line":"    def test_execute_with_root_helper(self):"},{"line_number":177,"context_line":"        CONF.set_override(\u0027root_helper\u0027, \u0027sudo\u0027, group\u003d\u0027ironic_lib\u0027)"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba8a016a_974c38c9","line":174,"in_reply_to":"ba8a016a_128cfa7d","updated":"2015-11-19 05:53:29.000000000","message":"Sure. I will add this test as well.","commit_id":"dea7eab749f5d305a58ff2bf7831aef9487f0ec2"}],"ironic_lib/utils.py":[{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"48a4105a4b6003d99d2227e7aa787697b80280b5","unresolved":false,"context_lines":[{"line_number":32,"context_line":""},{"line_number":33,"context_line":"utils_opts \u003d ["},{"line_number":34,"context_line":"    cfg.StrOpt(\u0027root_helper\u0027,"},{"line_number":35,"context_line":"               default\u003d\"\","},{"line_number":36,"context_line":"               help\u003d\u0027Command that is prefixed with the path, when running\u0027"},{"line_number":37,"context_line":"                    \u0027 commands as root.\u0027),"},{"line_number":38,"context_line":"]"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba8a016a_ac774701","line":35,"updated":"2015-11-16 19:37:04.000000000","message":"I think None is better than \"\".","commit_id":"f9000484a9e310046ed93abff63b6a14aa01bd1b"},{"author":{"_account_id":10574,"name":"Syed Ismail Faizan Barmawer","email":"faizan.barmawer@gmail.com","username":"barmawer"},"change_message_id":"dad0eda45ab48958cda4f33ba02afdeb2b945e86","unresolved":false,"context_lines":[{"line_number":32,"context_line":""},{"line_number":33,"context_line":"utils_opts \u003d ["},{"line_number":34,"context_line":"    cfg.StrOpt(\u0027root_helper\u0027,"},{"line_number":35,"context_line":"               default\u003d\"\","},{"line_number":36,"context_line":"               help\u003d\u0027Command that is prefixed with the path, when running\u0027"},{"line_number":37,"context_line":"                    \u0027 commands as root.\u0027),"},{"line_number":38,"context_line":"]"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba8a016a_5164d520","line":35,"in_reply_to":"ba8a016a_ac774701","updated":"2015-11-18 13:08:20.000000000","message":"Done","commit_id":"f9000484a9e310046ed93abff63b6a14aa01bd1b"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"48a4105a4b6003d99d2227e7aa787697b80280b5","unresolved":false,"context_lines":[{"line_number":34,"context_line":"    cfg.StrOpt(\u0027root_helper\u0027,"},{"line_number":35,"context_line":"               default\u003d\"\","},{"line_number":36,"context_line":"               help\u003d\u0027Command that is prefixed with the path, when running\u0027"},{"line_number":37,"context_line":"                    \u0027 commands as root.\u0027),"},{"line_number":38,"context_line":"]"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"CONF \u003d cfg.CONF"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba8a016a_cc464bbf","line":37,"updated":"2015-11-16 19:37:04.000000000","message":"How about \u0027Command that is prefixed to commands that are run as root. If not specified, no commands are run as root.\u0027","commit_id":"f9000484a9e310046ed93abff63b6a14aa01bd1b"},{"author":{"_account_id":10574,"name":"Syed Ismail Faizan Barmawer","email":"faizan.barmawer@gmail.com","username":"barmawer"},"change_message_id":"dad0eda45ab48958cda4f33ba02afdeb2b945e86","unresolved":false,"context_lines":[{"line_number":34,"context_line":"    cfg.StrOpt(\u0027root_helper\u0027,"},{"line_number":35,"context_line":"               default\u003d\"\","},{"line_number":36,"context_line":"               help\u003d\u0027Command that is prefixed with the path, when running\u0027"},{"line_number":37,"context_line":"                    \u0027 commands as root.\u0027),"},{"line_number":38,"context_line":"]"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"CONF \u003d cfg.CONF"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba8a016a_71679925","line":37,"in_reply_to":"ba8a016a_cc464bbf","updated":"2015-11-18 13:08:20.000000000","message":"Done","commit_id":"f9000484a9e310046ed93abff63b6a14aa01bd1b"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"48a4105a4b6003d99d2227e7aa787697b80280b5","unresolved":false,"context_lines":[{"line_number":70,"context_line":"        if len(root_helper.strip()):"},{"line_number":71,"context_line":"            kwargs[\u0027root_helper\u0027] \u003d root_helper"},{"line_number":72,"context_line":"        else:"},{"line_number":73,"context_line":"            kwargs[\u0027run_as_root\u0027] \u003d False"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"    result \u003d processutils.execute(*cmd, **kwargs)"},{"line_number":76,"context_line":"    LOG.debug(\u0027Execution completed, command line is \"%s\"\u0027,"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba8a016a_ecb0ef8d","line":73,"updated":"2015-11-16 19:37:04.000000000","message":"I\u0027d prefer if there was a comment about this logic. (Although I suppose if we mention it in the config\u0027s help that might be enough?)\n\nAlso, I\u0027m not sure we need a _get_root_helper() unless we want to check for a string with all spaces but ewww...\n\nEg, I think it is as simple as:\n  if not CONF.ironic_lib.root_helper:\n      kwargs[\u0027run_as_root\u0027] \u003d False\n  else:\n      kwargs[\u0027root_helper\u0027] \u003d CONF.ironic_lib.root_helper\n\nor if you really want to check for spaces:\n  kwargs[\u0027root_helper\u0027] \u003d CONF.ironic_lib.root_helper.strip()\n  if not kwargs[\u0027root_helper\u0027]:\n    kwargs[\u0027run_as_root\u0027] \u003d False","commit_id":"f9000484a9e310046ed93abff63b6a14aa01bd1b"},{"author":{"_account_id":10574,"name":"Syed Ismail Faizan Barmawer","email":"faizan.barmawer@gmail.com","username":"barmawer"},"change_message_id":"dad0eda45ab48958cda4f33ba02afdeb2b945e86","unresolved":false,"context_lines":[{"line_number":70,"context_line":"        if len(root_helper.strip()):"},{"line_number":71,"context_line":"            kwargs[\u0027root_helper\u0027] \u003d root_helper"},{"line_number":72,"context_line":"        else:"},{"line_number":73,"context_line":"            kwargs[\u0027run_as_root\u0027] \u003d False"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"    result \u003d processutils.execute(*cmd, **kwargs)"},{"line_number":76,"context_line":"    LOG.debug(\u0027Execution completed, command line is \"%s\"\u0027,"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba8a016a_0354c050","line":73,"in_reply_to":"ba8a016a_ecb0ef8d","updated":"2015-11-18 13:08:20.000000000","message":"I will go with the first example, as the second one may return error if we call strip on \"None\" object.","commit_id":"f9000484a9e310046ed93abff63b6a14aa01bd1b"}]}
