)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"53eafb61d3694ef6d8defc9f6e1af632462fdcac","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Tang Chen \u003ctangchen@cn.fujitsu.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2015-11-24 13:21:54 +0800"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Use API to translate node power states to json data."},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"The input of set_power_state() is different from the real string"},{"line_number":10,"context_line":"it sends to Ironic service in json data. The power states were"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"ba8a016a_7ded63b6","line":7,"updated":"2015-11-23 10:04:35.000000000","message":"not sure which API you mean here... probably \"Use a mapping to translate power states to API representation\" or somehting","commit_id":"a2e8744385fd2496f0f8e97a23da4f615a4e2793"}],"ironicclient/v1/node.py":[{"author":{"_account_id":8125,"name":"Michael Davies","email":"michael@the-davies.net","username":"mrda"},"change_message_id":"d4ae354fc092180e08bb03e12481edea45653e6a","unresolved":false,"context_lines":[{"line_number":40,"context_line":""},{"line_number":41,"context_line":"    try:"},{"line_number":42,"context_line":"        return power_states[state]"},{"line_number":43,"context_line":"    except Exception:"},{"line_number":44,"context_line":"        return \u0027N/A\u0027"},{"line_number":45,"context_line":""},{"line_number":46,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"ba8a016a_1472fb7c","line":43,"updated":"2015-11-23 04:03:51.000000000","message":"We shouldn\u0027t be catching all exceptions, instead we should catch the specific exception here (in this case KeyError).\n\nBut there\u0027s a better way.  I don\u0027t think we need this function at all.\n\nIf you defined the power_states dictionary at file level scope (using _power_states as it\u0027s name since it\u0027s internal to this file), you can use the dictionary\u0027s get() function with a default return value if the key isn\u0027t present in the dictionary.  i.e.\n\nAt file level scope:\n\n_power_states \u003d {\n    \u0027on\u0027: \u0027power on\u0027,\n    \u0027off\u0027: \u0027power off\u0027,\n    \u0027reboot\u0027: \u0027rebooting\u0027\n}\n\nand then below on line 286\n\ntarget \u003d {\u0027target\u0027: _power_states.get(state, state)}\n\nsince we want target to be set to the value of state if it isn\u0027t present as a key in the dictionary (to preserve current functionality).","commit_id":"9af7c23e78008147982d018e43f3ac5ed9f0a699"},{"author":{"_account_id":14937,"name":"Tang Chen","email":"imtangchen@163.com","username":"tangchen"},"change_message_id":"425d6b7ffa530907188d5c2db5ab4965121cd18c","unresolved":false,"context_lines":[{"line_number":40,"context_line":""},{"line_number":41,"context_line":"    try:"},{"line_number":42,"context_line":"        return power_states[state]"},{"line_number":43,"context_line":"    except Exception:"},{"line_number":44,"context_line":"        return \u0027N/A\u0027"},{"line_number":45,"context_line":""},{"line_number":46,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"ba8a016a_ef476449","line":43,"in_reply_to":"ba8a016a_1472fb7c","updated":"2015-11-23 04:13:54.000000000","message":"Done","commit_id":"9af7c23e78008147982d018e43f3ac5ed9f0a699"},{"author":{"_account_id":8125,"name":"Michael Davies","email":"michael@the-davies.net","username":"mrda"},"change_message_id":"d4ae354fc092180e08bb03e12481edea45653e6a","unresolved":false,"context_lines":[{"line_number":284,"context_line":"    def set_power_state(self, node_id, state):"},{"line_number":285,"context_line":"        path \u003d \"%s/states/power\" % node_id"},{"line_number":286,"context_line":"        state \u003d _map_power_state(state)"},{"line_number":287,"context_line":"        target \u003d {\u0027target\u0027: state}"},{"line_number":288,"context_line":"        return self._update(self._path(path), target, method\u003d\u0027PUT\u0027)"},{"line_number":289,"context_line":""},{"line_number":290,"context_line":"    def validate(self, node_uuid):"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba8a016a_d49233f6","line":287,"updated":"2015-11-23 04:03:51.000000000","message":"I don\u0027t think we need to assign \u0027state\u0027 here.\n\nWe could just have:\n\ntarget \u003d {\u0027target\u0027: _power_states.get(state, state)}\n\nwhich means that \u0027on\u0027, \u0027off\u0027, \u0027reboot\u0027 are handled as expected, and if it is anything else, that is what will be assigned.","commit_id":"9af7c23e78008147982d018e43f3ac5ed9f0a699"},{"author":{"_account_id":14937,"name":"Tang Chen","email":"imtangchen@163.com","username":"tangchen"},"change_message_id":"425d6b7ffa530907188d5c2db5ab4965121cd18c","unresolved":false,"context_lines":[{"line_number":284,"context_line":"    def set_power_state(self, node_id, state):"},{"line_number":285,"context_line":"        path \u003d \"%s/states/power\" % node_id"},{"line_number":286,"context_line":"        state \u003d _map_power_state(state)"},{"line_number":287,"context_line":"        target \u003d {\u0027target\u0027: state}"},{"line_number":288,"context_line":"        return self._update(self._path(path), target, method\u003d\u0027PUT\u0027)"},{"line_number":289,"context_line":""},{"line_number":290,"context_line":"    def validate(self, node_uuid):"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba8a016a_8f7338b4","line":287,"in_reply_to":"ba8a016a_d49233f6","updated":"2015-11-23 04:13:54.000000000","message":"Done","commit_id":"9af7c23e78008147982d018e43f3ac5ed9f0a699"}]}
