)]}'
{"ironic/api/controllers/v1/node.py":[{"author":{"_account_id":7711,"name":"Yuriy Zveryanskyy","email":"yzveryanskyy@mirantis.com","username":"yuriyz"},"change_message_id":"aec35a6f6d630d5c299c7b908244f3f298b0cdf7","unresolved":false,"context_lines":[{"line_number":511,"context_line":"        except jsonpatch.JsonPatchException as e:"},{"line_number":512,"context_line":"            LOG.exception(e)"},{"line_number":513,"context_line":"            raise wsme.exc.ClientSideError(_(\"Patching Error: %s\") % e)"},{"line_number":514,"context_line":""},{"line_number":515,"context_line":"        # Update only the fields that have changed"},{"line_number":516,"context_line":"        for field in objects.Node.fields:"},{"line_number":517,"context_line":"            if rpc_node[field] !\u003d getattr(node, field):"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAATn%2F9QTk%3D","line":514,"updated":"2013-12-13 13:13:47.000000000","message":"Lucas, this situation for example:\n\n1) Node have a valid driver.\n\n2) Conductor that have this driver crashed and driver becomes unsupported.\n\n3) Node will successfully updated from patch with the same driver.\n\nWhat do you think?","commit_id":"a951f5d0ed76c63077f162984773ae8288702083"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"8bde0a88f11501b4ab555cb3b3ba65b38f2f208b","unresolved":false,"context_lines":[{"line_number":511,"context_line":"        except jsonpatch.JsonPatchException as e:"},{"line_number":512,"context_line":"            LOG.exception(e)"},{"line_number":513,"context_line":"            raise wsme.exc.ClientSideError(_(\"Patching Error: %s\") % e)"},{"line_number":514,"context_line":""},{"line_number":515,"context_line":"        # Update only the fields that have changed"},{"line_number":516,"context_line":"        for field in objects.Node.fields:"},{"line_number":517,"context_line":"            if rpc_node[field] !\u003d getattr(node, field):"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAATn%2F9QF0%3D","line":514,"in_reply_to":"AAAATn%2F9QGY%3D","updated":"2013-12-13 13:58:19.000000000","message":"Forgot to mention. The discussion is at line 484","commit_id":"a951f5d0ed76c63077f162984773ae8288702083"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"852a5fe4f42e5b4171ba8ce0d1bdf78dbf30cfbf","unresolved":false,"context_lines":[{"line_number":511,"context_line":"        except jsonpatch.JsonPatchException as e:"},{"line_number":512,"context_line":"            LOG.exception(e)"},{"line_number":513,"context_line":"            raise wsme.exc.ClientSideError(_(\"Patching Error: %s\") % e)"},{"line_number":514,"context_line":""},{"line_number":515,"context_line":"        # Update only the fields that have changed"},{"line_number":516,"context_line":"        for field in objects.Node.fields:"},{"line_number":517,"context_line":"            if rpc_node[field] !\u003d getattr(node, field):"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAATn%2F9QGY%3D","line":514,"in_reply_to":"AAAATn%2F9QTk%3D","updated":"2013-12-13 13:57:18.000000000","message":"Hi Yuri,\n\nThat\u0027s a good point, maybe checking the driver every time the node is updated (independent of if have updated the driver or not) might be useful for that. But I don\u0027t think it\u0027s the correct thing to do. Me and Max had some discussion around it: If the conductor(s) that have that driver crash what we do with the node[1].\n\nSo basically, we will need some mechanism that will constant check whether the nodes that contains a specific driver still can be scheduled, and in the nodes we need to offer a way (an attribute for e.g) to mark the node as \"can\u0027t-be-deployed\".\n\nThat said, I think that flag will already tell the user that the current driver is invalid, and for that reason I don\u0027t think we should check whether the driver is valid or not on every update request, only when the request is actually changing the driver.\n\n[1] https://review.openstack.org/#/c/57495/21/ironic/api/controllers/v1/node.py","commit_id":"a951f5d0ed76c63077f162984773ae8288702083"},{"author":{"_account_id":7711,"name":"Yuriy Zveryanskyy","email":"yzveryanskyy@mirantis.com","username":"yuriyz"},"change_message_id":"ea87143ee2783d918ff70bfa2f10a8f343184ab1","unresolved":false,"context_lines":[{"line_number":373,"context_line":"        return nodes"},{"line_number":374,"context_line":""},{"line_number":375,"context_line":"    def _ensure_driver_is_supported(self, driver):"},{"line_number":376,"context_line":"        drivers \u003d pecan.request.dbapi.list_active_conductor_drivers("},{"line_number":377,"context_line":"                                     interval\u003dCONF.conductor.heartbeat_timeout)"},{"line_number":378,"context_line":"        if driver not in drivers:"},{"line_number":379,"context_line":"            raise wsme.exc.ClientSideError(_(\"\u0027%s\u0027 is not a supported \""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F88KQ%3D","line":376,"updated":"2013-12-18 15:17:34.000000000","message":"Lucas, list_active_conductor_drivers method already renamed.","commit_id":"8069dfab4150ea8c2ab7b3416863e17e8d174ef7"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"51925375cb5e62021053f66200d017178fc44781","unresolved":false,"context_lines":[{"line_number":373,"context_line":"        return nodes"},{"line_number":374,"context_line":""},{"line_number":375,"context_line":"    def _ensure_driver_is_supported(self, driver):"},{"line_number":376,"context_line":"        drivers \u003d pecan.request.dbapi.list_active_conductor_drivers("},{"line_number":377,"context_line":"                                     interval\u003dCONF.conductor.heartbeat_timeout)"},{"line_number":378,"context_line":"        if driver not in drivers:"},{"line_number":379,"context_line":"            raise wsme.exc.ClientSideError(_(\"\u0027%s\u0027 is not a supported \""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F87%2FA%3D","line":376,"in_reply_to":"AAAATn%2F88KQ%3D","updated":"2013-12-18 16:05:52.000000000","message":"Ah great I will rebase it, thank you!","commit_id":"8069dfab4150ea8c2ab7b3416863e17e8d174ef7"},{"author":{"_account_id":4190,"name":"lifeless","email":"robertc@robertcollins.net","username":"lifeless"},"change_message_id":"b4ead8943f9ccc6a1ab36a12b8da2a5e432e0083","unresolved":false,"context_lines":[{"line_number":377,"context_line":"                                     interval\u003dCONF.conductor.heartbeat_timeout)"},{"line_number":378,"context_line":"        if driver not in drivers:"},{"line_number":379,"context_line":"            raise wsme.exc.ClientSideError(_(\"\u0027%s\u0027 is not a supported \""},{"line_number":380,"context_line":"                                            \"driver\") % driver)"},{"line_number":381,"context_line":""},{"line_number":382,"context_line":"    @wsme_pecan.wsexpose(NodeCollection, wtypes.text, wtypes.text,"},{"line_number":383,"context_line":"               wtypes.text, wtypes.text, int, wtypes.text, wtypes.text)"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F8%2FjM%3D","line":380,"updated":"2013-12-17 23:11:59.000000000","message":"There is a mismatch here: we talk about drivers \u0027active on conductor X\" and then short-circuit that to \u0027supported driver\u0027. But - I think supported driver is /easily/ misinterpreted. Can we stick to active?","commit_id":"8069dfab4150ea8c2ab7b3416863e17e8d174ef7"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"51925375cb5e62021053f66200d017178fc44781","unresolved":false,"context_lines":[{"line_number":377,"context_line":"                                     interval\u003dCONF.conductor.heartbeat_timeout)"},{"line_number":378,"context_line":"        if driver not in drivers:"},{"line_number":379,"context_line":"            raise wsme.exc.ClientSideError(_(\"\u0027%s\u0027 is not a supported \""},{"line_number":380,"context_line":"                                            \"driver\") % driver)"},{"line_number":381,"context_line":""},{"line_number":382,"context_line":"    @wsme_pecan.wsexpose(NodeCollection, wtypes.text, wtypes.text,"},{"line_number":383,"context_line":"               wtypes.text, wtypes.text, int, wtypes.text, wtypes.text)"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F878I%3D","line":380,"in_reply_to":"AAAATn%2F8%2FjM%3D","updated":"2013-12-18 16:05:52.000000000","message":"+1 yes we should :) Will make the message more consistent.\n\nThank you","commit_id":"8069dfab4150ea8c2ab7b3416863e17e8d174ef7"},{"author":{"_account_id":4190,"name":"lifeless","email":"robertc@robertcollins.net","username":"lifeless"},"change_message_id":"b4ead8943f9ccc6a1ab36a12b8da2a5e432e0083","unresolved":false,"context_lines":[{"line_number":468,"context_line":"        if self._from_chassis:"},{"line_number":469,"context_line":"            raise exception.OperationNotPermitted"},{"line_number":470,"context_line":""},{"line_number":471,"context_line":"        self._ensure_driver_is_supported(node.driver)"},{"line_number":472,"context_line":"        try:"},{"line_number":473,"context_line":"            new_node \u003d pecan.request.dbapi.create_node(node.as_dict())"},{"line_number":474,"context_line":"        except Exception as e:"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F8%2FjI%3D","line":471,"updated":"2013-12-17 23:11:59.000000000","message":"e.g. here - self._ensure_driver_is_active(node.driver)","commit_id":"8069dfab4150ea8c2ab7b3416863e17e8d174ef7"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"51925375cb5e62021053f66200d017178fc44781","unresolved":false,"context_lines":[{"line_number":468,"context_line":"        if self._from_chassis:"},{"line_number":469,"context_line":"            raise exception.OperationNotPermitted"},{"line_number":470,"context_line":""},{"line_number":471,"context_line":"        self._ensure_driver_is_supported(node.driver)"},{"line_number":472,"context_line":"        try:"},{"line_number":473,"context_line":"            new_node \u003d pecan.request.dbapi.create_node(node.as_dict())"},{"line_number":474,"context_line":"        except Exception as e:"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F878A%3D","line":471,"in_reply_to":"AAAATn%2F8%2FjI%3D","updated":"2013-12-18 16:05:52.000000000","message":"will do","commit_id":"8069dfab4150ea8c2ab7b3416863e17e8d174ef7"}],"ironic/tests/api/test_nodes.py":[{"author":{"_account_id":2889,"name":"Aeva Black","email":"aeva.online@gmail.com","username":"tenbrae"},"change_message_id":"b3d5abae02352faa3a03442469ed348aafc24d29","unresolved":false,"context_lines":[{"line_number":629,"context_line":"        super(TestDelete, self).setUp()"},{"line_number":630,"context_line":"        cdict \u003d dbutils.get_test_chassis()"},{"line_number":631,"context_line":"        self.chassis \u003d self.dbapi.create_chassis(cdict)"},{"line_number":632,"context_line":"        p \u003d mock.patch.object(self.dbapi, \u0027list_active_conductor_drivers\u0027,"},{"line_number":633,"context_line":"                              return_value\u003d[\u0027fake\u0027])"},{"line_number":634,"context_line":"        self.mock_lacd \u003d p.start()"},{"line_number":635,"context_line":"        self.addCleanup(p.stop)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAATn%2F9Nww%3D","line":632,"updated":"2013-12-13 22:43:20.000000000","message":"is this actually necessary? it doesn\u0027t look like l_a_c_d is in the code path for DELETEs","commit_id":"a951f5d0ed76c63077f162984773ae8288702083"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"ab715a0b4f2620eba5f956afcb411ea195fd4a60","unresolved":false,"context_lines":[{"line_number":629,"context_line":"        super(TestDelete, self).setUp()"},{"line_number":630,"context_line":"        cdict \u003d dbutils.get_test_chassis()"},{"line_number":631,"context_line":"        self.chassis \u003d self.dbapi.create_chassis(cdict)"},{"line_number":632,"context_line":"        p \u003d mock.patch.object(self.dbapi, \u0027list_active_conductor_drivers\u0027,"},{"line_number":633,"context_line":"                              return_value\u003d[\u0027fake\u0027])"},{"line_number":634,"context_line":"        self.mock_lacd \u003d p.start()"},{"line_number":635,"context_line":"        self.addCleanup(p.stop)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAATn%2F9I8E%3D","line":632,"in_reply_to":"AAAATn%2F9I%2BA%3D","updated":"2013-12-16 12:25:53.000000000","message":"+1 I will file it :)","commit_id":"a951f5d0ed76c63077f162984773ae8288702083"},{"author":{"_account_id":8968,"name":"Max Lobur","email":"max_lobur@outlook.com","username":"max_lobur"},"change_message_id":"918ee6bf74763c7c1a3b6241015524b900bb709b","unresolved":false,"context_lines":[{"line_number":629,"context_line":"        super(TestDelete, self).setUp()"},{"line_number":630,"context_line":"        cdict \u003d dbutils.get_test_chassis()"},{"line_number":631,"context_line":"        self.chassis \u003d self.dbapi.create_chassis(cdict)"},{"line_number":632,"context_line":"        p \u003d mock.patch.object(self.dbapi, \u0027list_active_conductor_drivers\u0027,"},{"line_number":633,"context_line":"                              return_value\u003d[\u0027fake\u0027])"},{"line_number":634,"context_line":"        self.mock_lacd \u003d p.start()"},{"line_number":635,"context_line":"        self.addCleanup(p.stop)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAATn%2F9I%2BA%3D","line":632,"in_reply_to":"AAAATn%2F9JBk%3D","updated":"2013-12-16 12:20:03.000000000","message":"Reasonable to me. Maybe it\u0027s worth to fill a bug to rework tests, how do you think?","commit_id":"a951f5d0ed76c63077f162984773ae8288702083"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"8eee1513633d02164f70445badf2ac7b03862d74","unresolved":false,"context_lines":[{"line_number":629,"context_line":"        super(TestDelete, self).setUp()"},{"line_number":630,"context_line":"        cdict \u003d dbutils.get_test_chassis()"},{"line_number":631,"context_line":"        self.chassis \u003d self.dbapi.create_chassis(cdict)"},{"line_number":632,"context_line":"        p \u003d mock.patch.object(self.dbapi, \u0027list_active_conductor_drivers\u0027,"},{"line_number":633,"context_line":"                              return_value\u003d[\u0027fake\u0027])"},{"line_number":634,"context_line":"        self.mock_lacd \u003d p.start()"},{"line_number":635,"context_line":"        self.addCleanup(p.stop)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAATn%2F9JBk%3D","line":632,"in_reply_to":"AAAATn%2F9JZI%3D","updated":"2013-12-16 12:09:17.000000000","message":"Yes, as @Max some methods on this class are using post_json to create the node and by POSTing data the API will validate the driver that\u0027s why it\u0027s need to be mocked here.\n\nI think this is something that worth fixing, creating the node with the \u0027dbapi\u0027 object instead of posting to the api, but I think that a change like that is unrelated to this patch, should be done in another patch.","commit_id":"a951f5d0ed76c63077f162984773ae8288702083"},{"author":{"_account_id":8968,"name":"Max Lobur","email":"max_lobur@outlook.com","username":"max_lobur"},"change_message_id":"25c9a6c38f4db89b53359fe683fcf00598ceaa7d","unresolved":false,"context_lines":[{"line_number":629,"context_line":"        super(TestDelete, self).setUp()"},{"line_number":630,"context_line":"        cdict \u003d dbutils.get_test_chassis()"},{"line_number":631,"context_line":"        self.chassis \u003d self.dbapi.create_chassis(cdict)"},{"line_number":632,"context_line":"        p \u003d mock.patch.object(self.dbapi, \u0027list_active_conductor_drivers\u0027,"},{"line_number":633,"context_line":"                              return_value\u003d[\u0027fake\u0027])"},{"line_number":634,"context_line":"        self.mock_lacd \u003d p.start()"},{"line_number":635,"context_line":"        self.addCleanup(p.stop)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAATn%2F9JZI%3D","line":632,"in_reply_to":"AAAATn%2F9Nww%3D","updated":"2013-12-16 10:44:47.000000000","message":"It seems it\u0027s called when creating a test data, e.g. self.post_json(\u0027/nodes\u0027, ndict)","commit_id":"a951f5d0ed76c63077f162984773ae8288702083"},{"author":{"_account_id":4190,"name":"lifeless","email":"robertc@robertcollins.net","username":"lifeless"},"change_message_id":"b4ead8943f9ccc6a1ab36a12b8da2a5e432e0083","unresolved":false,"context_lines":[{"line_number":324,"context_line":"        self.addCleanup(p.stop)"},{"line_number":325,"context_line":"        p \u003d mock.patch.object(self.dbapi, \u0027list_active_conductor_drivers\u0027,"},{"line_number":326,"context_line":"                              return_value\u003d[\u0027fake\u0027])"},{"line_number":327,"context_line":"        self.mock_lacd \u003d p.start()"},{"line_number":328,"context_line":"        self.addCleanup(p.stop)"},{"line_number":329,"context_line":""},{"line_number":330,"context_line":"    def test_update_ok(self):"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F8%2FiU%3D","line":327,"updated":"2013-12-17 23:11:59.000000000","message":"No need to assign this to a variable: just do\n\n\n self.addCleanup(p.stop)\n p.start()\n\nNote the order - avoids race conditions.","commit_id":"8069dfab4150ea8c2ab7b3416863e17e8d174ef7"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"51925375cb5e62021053f66200d017178fc44781","unresolved":false,"context_lines":[{"line_number":324,"context_line":"        self.addCleanup(p.stop)"},{"line_number":325,"context_line":"        p \u003d mock.patch.object(self.dbapi, \u0027list_active_conductor_drivers\u0027,"},{"line_number":326,"context_line":"                              return_value\u003d[\u0027fake\u0027])"},{"line_number":327,"context_line":"        self.mock_lacd \u003d p.start()"},{"line_number":328,"context_line":"        self.addCleanup(p.stop)"},{"line_number":329,"context_line":""},{"line_number":330,"context_line":"    def test_update_ok(self):"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F877o%3D","line":327,"in_reply_to":"AAAATn%2F8%2FiU%3D","updated":"2013-12-18 16:05:52.000000000","message":"A nice! I will change it, thanks","commit_id":"8069dfab4150ea8c2ab7b3416863e17e8d174ef7"},{"author":{"_account_id":4190,"name":"lifeless","email":"robertc@robertcollins.net","username":"lifeless"},"change_message_id":"b4ead8943f9ccc6a1ab36a12b8da2a5e432e0083","unresolved":false,"context_lines":[{"line_number":489,"context_line":"            self.patch_json(\u0027/nodes/%s\u0027 % self.node[\u0027uuid\u0027],"},{"line_number":490,"context_line":"                            [{\u0027path\u0027: \u0027/driver\u0027, \u0027value\u0027: new_driver,"},{"line_number":491,"context_line":"                              \u0027op\u0027: \u0027replace\u0027}])"},{"line_number":492,"context_line":"            self.mock_update_node.assert_called_once_with(mock.ANY, mock.ANY)"},{"line_number":493,"context_line":""},{"line_number":494,"context_line":""},{"line_number":495,"context_line":"class TestPost(base.FunctionalTest):"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F8%2Fh0%3D","line":492,"updated":"2013-12-17 23:11:59.000000000","message":"We need one more tests IMO\n\n replace_inactive_driver - that is, it\u0027s a driver that was active but isn\u0027t now.","commit_id":"8069dfab4150ea8c2ab7b3416863e17e8d174ef7"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"51925375cb5e62021053f66200d017178fc44781","unresolved":false,"context_lines":[{"line_number":489,"context_line":"            self.patch_json(\u0027/nodes/%s\u0027 % self.node[\u0027uuid\u0027],"},{"line_number":490,"context_line":"                            [{\u0027path\u0027: \u0027/driver\u0027, \u0027value\u0027: new_driver,"},{"line_number":491,"context_line":"                              \u0027op\u0027: \u0027replace\u0027}])"},{"line_number":492,"context_line":"            self.mock_update_node.assert_called_once_with(mock.ANY, mock.ANY)"},{"line_number":493,"context_line":""},{"line_number":494,"context_line":""},{"line_number":495,"context_line":"class TestPost(base.FunctionalTest):"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F874k%3D","line":492,"in_reply_to":"AAAATn%2F8%2Fh0%3D","updated":"2013-12-18 16:05:52.000000000","message":"How is it different from test_replace_invalid_driver()?\n\nDriver is valid if it\u0027s present in the list returned by list_active_conductor_drivers() or invalid if not present.\n\nI think both tests cover it already","commit_id":"8069dfab4150ea8c2ab7b3416863e17e8d174ef7"},{"author":{"_account_id":4190,"name":"lifeless","email":"robertc@robertcollins.net","username":"lifeless"},"change_message_id":"2fffdc78e576014b7433491bfab8e78a3d402d5d","unresolved":false,"context_lines":[{"line_number":489,"context_line":"            self.patch_json(\u0027/nodes/%s\u0027 % self.node[\u0027uuid\u0027],"},{"line_number":490,"context_line":"                            [{\u0027path\u0027: \u0027/driver\u0027, \u0027value\u0027: new_driver,"},{"line_number":491,"context_line":"                              \u0027op\u0027: \u0027replace\u0027}])"},{"line_number":492,"context_line":"            self.mock_update_node.assert_called_once_with(mock.ANY, mock.ANY)"},{"line_number":493,"context_line":""},{"line_number":494,"context_line":""},{"line_number":495,"context_line":"class TestPost(base.FunctionalTest):"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F84RY%3D","line":492,"in_reply_to":"AAAATn%2F874k%3D","updated":"2013-12-19 08:44:49.000000000","message":"One case is driver never existed. Other is driver existed but hasn\u0027t checked in in a while. I guess specifically I want to ensure that this code *does not* pass in a too-high value for interval.","commit_id":"8069dfab4150ea8c2ab7b3416863e17e8d174ef7"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"e83bc50d9ab75cae3e104c335de6b6f923dd74b5","unresolved":false,"context_lines":[{"line_number":317,"context_line":"        ndict \u003d dbutils.get_test_node()"},{"line_number":318,"context_line":"        self.node \u003d self.dbapi.create_node(ndict)"},{"line_number":319,"context_line":"        p \u003d mock.patch.object(rpcapi.ConductorAPI, \u0027update_node\u0027)"},{"line_number":320,"context_line":"        self.mock_update_node \u003d p.start()"},{"line_number":321,"context_line":"        self.addCleanup(p.stop)"},{"line_number":322,"context_line":"        p \u003d mock.patch.object(rpcapi.ConductorAPI, \u0027change_node_power_state\u0027)"},{"line_number":323,"context_line":"        self.mock_cnps \u003d p.start()"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAATn%2F87Pg%3D","side":"PARENT","line":320,"updated":"2013-12-18 18:14:20.000000000","message":"Now things look a bit inconsistent. If you feel like it, it might be good to change them to all have the same pattern of self.addCleanup(p.stop), ..\u003d p.start().","commit_id":"ec82253df7c700cf3cfc9f4de8d04ca797cbf2cb"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"e83bc50d9ab75cae3e104c335de6b6f923dd74b5","unresolved":false,"context_lines":[{"line_number":482,"context_line":""},{"line_number":483,"context_line":"    def test_replace_valid_driver(self):"},{"line_number":484,"context_line":"        new_driver \u003d \u0027cappuccino-driver\u0027"},{"line_number":485,"context_line":"        with mock.patch.object(self.dbapi, \u0027get_active_driver_dict\u0027) \\"},{"line_number":486,"context_line":"                as l_mock:"},{"line_number":487,"context_line":"            l_mock.return_value \u003d {new_driver: set([\u0027fake-host\u0027])}"},{"line_number":488,"context_line":"            self.mock_update_node.return_value \u003d self.node"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAATn%2F87Mo%3D","line":485,"updated":"2013-12-18 18:14:20.000000000","message":"I suppose you could have also just changed the return value for the mock object that you added in setUp above?","commit_id":"9e8e2ec59cf0f4fb3633e916620b270c6fa64cd0"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"9a4f9d5e2fd18fbd43fa7fc1dc7fbba0e38c4a45","unresolved":false,"context_lines":[{"line_number":482,"context_line":""},{"line_number":483,"context_line":"    def test_replace_valid_driver(self):"},{"line_number":484,"context_line":"        new_driver \u003d \u0027cappuccino-driver\u0027"},{"line_number":485,"context_line":"        with mock.patch.object(self.dbapi, \u0027get_active_driver_dict\u0027) \\"},{"line_number":486,"context_line":"                as l_mock:"},{"line_number":487,"context_line":"            l_mock.return_value \u003d {new_driver: set([\u0027fake-host\u0027])}"},{"line_number":488,"context_line":"            self.mock_update_node.return_value \u003d self.node"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAATn%2F81rI%3D","line":485,"in_reply_to":"AAAATn%2F84Fw%3D","updated":"2013-12-19 17:34:10.000000000","message":"Right, but you could also get a new driver by doing (if the new mock was self.driverm): self.driverm.return_value \u003d {\u0027cappuccino-driver\u0027: set([\u0027fake-host\u0027])}\n\nYour solution works too :)\n\nHaving said that, I took a closer look, and am wondering. Is there a rule-of-thumb as to when one puts mock objects in the setUp()? In this case, only these two test_replace_*driver() need a mock for get_active_driver_dict, so would it be better/clearer to only use them in these two tests?","commit_id":"9e8e2ec59cf0f4fb3633e916620b270c6fa64cd0"},{"author":{"_account_id":7711,"name":"Yuriy Zveryanskyy","email":"yzveryanskyy@mirantis.com","username":"yuriyz"},"change_message_id":"b3e6ae58cbf9c37599e3fceb8825edbbc66f7694","unresolved":false,"context_lines":[{"line_number":482,"context_line":""},{"line_number":483,"context_line":"    def test_replace_valid_driver(self):"},{"line_number":484,"context_line":"        new_driver \u003d \u0027cappuccino-driver\u0027"},{"line_number":485,"context_line":"        with mock.patch.object(self.dbapi, \u0027get_active_driver_dict\u0027) \\"},{"line_number":486,"context_line":"                as l_mock:"},{"line_number":487,"context_line":"            l_mock.return_value \u003d {new_driver: set([\u0027fake-host\u0027])}"},{"line_number":488,"context_line":"            self.mock_update_node.return_value \u003d self.node"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAATn%2F84Fw%3D","line":485,"in_reply_to":"AAAATn%2F87Mo%3D","updated":"2013-12-19 09:29:47.000000000","message":"Ruby, we need a new driver here, not \u0027fake\u0027. IMO mock in setUp should looks like\n\n...return_value\u003d{\u0027fake\u0027: set([\u0027fake-host\u0027]), \u0027cappuccino-driver\u0027: set([\u0027fake-host\u0027])}","commit_id":"9e8e2ec59cf0f4fb3633e916620b270c6fa64cd0"}]}
