)]}'
{"ironic/api/controllers/v1/base.py":[{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"b1b40f39fe95cd35a5e5f663baf07777316f35ab","unresolved":false,"context_lines":[{"line_number":23,"context_line":""},{"line_number":24,"context_line":"class APIBase(wtypes.Base):"},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"    def defaults(self):"},{"line_number":27,"context_line":"        \"\"\"Returns a dict of attributes and their default values\"\"\""},{"line_number":28,"context_line":"        return {}"},{"line_number":29,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAS3%2F%2FI5w%3D","line":26,"updated":"2013-10-03 16:35:31.000000000","message":"Should it have the @staticmethod decorator as well as in the nodes.py?","commit_id":"be52d0883817d1b42bfed96df0a0671b2d18c5e8"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"b1b40f39fe95cd35a5e5f663baf07777316f35ab","unresolved":false,"context_lines":[{"line_number":33,"context_line":"        return {}"},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"    def default_blacklist_message(self, key):"},{"line_number":36,"context_line":"        return \u0027Attribute: \\\u0027%s\\\u0027 is not modifiable\u0027 % key"},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"    def as_dict(self):"},{"line_number":39,"context_line":"        \"\"\"Render this object as a dict of its fields.\"\"\""}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAS3%2F%2FI9k%3D","line":36,"updated":"2013-10-03 16:35:31.000000000","message":"You can use double-quote on the string so you avoid having to scape the single quote there.\n\nreturn \"Attribute: \u0027%s\u0027 is not modifiable\" % key","commit_id":"be52d0883817d1b42bfed96df0a0671b2d18c5e8"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"b1b40f39fe95cd35a5e5f663baf07777316f35ab","unresolved":false,"context_lines":[{"line_number":55,"context_line":"            for key in self.defaults():"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":"                # Ignore blacklisted attributes"},{"line_number":58,"context_line":"                if key in self.blacklist().keys():"},{"line_number":59,"context_line":"                    continue"},{"line_number":60,"context_line":"                else:"},{"line_number":61,"context_line":"                    # Restore defaults for any removed attributes"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAS3%2F%2FI88%3D","line":58,"updated":"2013-10-03 16:35:31.000000000","message":"keys() call is not needed, by default it will iterate through keys. (same as you did on self.defaults() )\n\n\nOr, you maybe want to use the .iteritems() generator as well.","commit_id":"be52d0883817d1b42bfed96df0a0671b2d18c5e8"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"b1b40f39fe95cd35a5e5f663baf07777316f35ab","unresolved":false,"context_lines":[{"line_number":76,"context_line":"            raise wsme.exc.ClientSideError(\", \".join(errors))"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":"    def validate_resource(self, new_obj):"},{"line_number":79,"context_line":"        \"\"\"Default Validation for WSME types.  Checks for blacklisted changes\"\"\""},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"        errors \u003d []"},{"line_number":82,"context_line":"        obj \u003d self.as_dict()"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAS3%2F%2FI9s%3D","line":79,"updated":"2013-10-03 16:35:31.000000000","message":"double white space after \u0027.\u0027","commit_id":"be52d0883817d1b42bfed96df0a0671b2d18c5e8"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"cbd174f018fe4973042e6114508b74d0180da6a5","unresolved":false,"context_lines":[{"line_number":35,"context_line":"        return {}"},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"    def default_blacklist_message(self, key):"},{"line_number":38,"context_line":"        return \"Attribute: \\\u0027%s\\\u0027 is not modifiable\" % key"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    def as_dict(self):"},{"line_number":41,"context_line":"        \"\"\"Render this object as a dict of its fields.\"\"\""}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAATH%2F%2F8n0%3D","line":38,"updated":"2013-10-07 16:40:18.000000000","message":"you don\u0027t need to skip the single quotation mark because ur using a double quotation mark on the string.\n\nAlso, please wrap the message with _() for I18n","commit_id":"eb497ec506c572815d267869b97ee12b03fffd44"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"cbd174f018fe4973042e6114508b74d0180da6a5","unresolved":false,"context_lines":[{"line_number":75,"context_line":"            errors \u003d self.validate_resource(new_obj)"},{"line_number":76,"context_line":"            return diff"},{"line_number":77,"context_line":"        except jsonpatch.JsonPatchException as jpe:"},{"line_number":78,"context_line":"            errors.append(\"Patching Error: %s\" % jpe)"},{"line_number":79,"context_line":""},{"line_number":80,"context_line":"        if errors:"},{"line_number":81,"context_line":"            raise wsme.exc.ClientSideError(\", \".join(errors))"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAATH%2F%2F8mk%3D","line":78,"updated":"2013-10-07 16:40:18.000000000","message":"Please wrap the message with _() for I18n","commit_id":"eb497ec506c572815d267869b97ee12b03fffd44"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"6f4ba20d894672a1e38659844579e9d272d25bcb","unresolved":false,"context_lines":[{"line_number":32,"context_line":"        \"\"\"Returns a dict of blacklisted attributes with an associated error"},{"line_number":33,"context_line":"        message."},{"line_number":34,"context_line":"        \"\"\""},{"line_number":35,"context_line":"        return {}"},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"    def default_blacklist_message(self, key):"},{"line_number":38,"context_line":"        return \"Attribute: \u0027%s\u0027 is not modifiable\" % key"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATH%2F%2FzKg%3D","line":35,"updated":"2013-10-09 17:07:29.000000000","message":"Should we have some common list of objects that will be automatic rejected across all the resources? e.g links and id\u0027s","commit_id":"44e8a6a94cf7a834cfdde072f87a24f89d39c826"},{"author":{"_account_id":7625,"name":"Martyn Taylor","email":"mtaylor@redhat.com","username":"mtaylor"},"change_message_id":"75a40d0179308d67d49addaaa8e549de0b932b3e","unresolved":false,"context_lines":[{"line_number":32,"context_line":"        \"\"\"Returns a dict of blacklisted attributes with an associated error"},{"line_number":33,"context_line":"        message."},{"line_number":34,"context_line":"        \"\"\""},{"line_number":35,"context_line":"        return {}"},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"    def default_blacklist_message(self, key):"},{"line_number":38,"context_line":"        return \"Attribute: \u0027%s\u0027 is not modifiable\" % key"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATH%2F%2Fv2k%3D","line":35,"in_reply_to":"AAAATH%2F%2FzHc%3D","updated":"2013-10-10 11:56:13.000000000","message":"I\u0027m not sure what you mean here?","commit_id":"44e8a6a94cf7a834cfdde072f87a24f89d39c826"},{"author":{"_account_id":7625,"name":"Martyn Taylor","email":"mtaylor@redhat.com","username":"mtaylor"},"change_message_id":"75a40d0179308d67d49addaaa8e549de0b932b3e","unresolved":false,"context_lines":[{"line_number":32,"context_line":"        \"\"\"Returns a dict of blacklisted attributes with an associated error"},{"line_number":33,"context_line":"        message."},{"line_number":34,"context_line":"        \"\"\""},{"line_number":35,"context_line":"        return {}"},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"    def default_blacklist_message(self, key):"},{"line_number":38,"context_line":"        return \"Attribute: \u0027%s\u0027 is not modifiable\" % key"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATH%2F%2Fv3M%3D","line":35,"in_reply_to":"AAAATH%2F%2FzKg%3D","updated":"2013-10-10 11:56:13.000000000","message":"Yeah, I can add some defaults here, we will need to follow a similar approach to what you suggested with default validation too.","commit_id":"44e8a6a94cf7a834cfdde072f87a24f89d39c826"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"6ea6add775b9be3fa987b68314a6dd15b2db3744","unresolved":false,"context_lines":[{"line_number":32,"context_line":"        \"\"\"Returns a dict of blacklisted attributes with an associated error"},{"line_number":33,"context_line":"        message."},{"line_number":34,"context_line":"        \"\"\""},{"line_number":35,"context_line":"        return {}"},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"    def default_blacklist_message(self, key):"},{"line_number":38,"context_line":"        return \"Attribute: \u0027%s\u0027 is not modifiable\" % key"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATH%2F%2FzHc%3D","line":35,"in_reply_to":"AAAATH%2F%2FzKg%3D","updated":"2013-10-09 17:12:36.000000000","message":"s/objects/attributes","commit_id":"44e8a6a94cf7a834cfdde072f87a24f89d39c826"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"6f4ba20d894672a1e38659844579e9d272d25bcb","unresolved":false,"context_lines":[{"line_number":35,"context_line":"        return {}"},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"    def default_blacklist_message(self, key):"},{"line_number":38,"context_line":"        return \"Attribute: \u0027%s\u0027 is not modifiable\" % key"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    def as_dict(self):"},{"line_number":41,"context_line":"        \"\"\"Render this object as a dict of its fields.\"\"\""}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATH%2F%2FzJw%3D","line":38,"updated":"2013-10-09 17:07:29.000000000","message":"i18n","commit_id":"44e8a6a94cf7a834cfdde072f87a24f89d39c826"},{"author":{"_account_id":7625,"name":"Martyn Taylor","email":"mtaylor@redhat.com","username":"mtaylor"},"change_message_id":"75a40d0179308d67d49addaaa8e549de0b932b3e","unresolved":false,"context_lines":[{"line_number":35,"context_line":"        return {}"},{"line_number":36,"context_line":""},{"line_number":37,"context_line":"    def default_blacklist_message(self, key):"},{"line_number":38,"context_line":"        return \"Attribute: \u0027%s\u0027 is not modifiable\" % key"},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"    def as_dict(self):"},{"line_number":41,"context_line":"        \"\"\"Render this object as a dict of its fields.\"\"\""}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATH%2F%2Fv24%3D","line":38,"in_reply_to":"AAAATH%2F%2FzJw%3D","updated":"2013-10-10 11:56:13.000000000","message":"Ah, good catch thanks.","commit_id":"44e8a6a94cf7a834cfdde072f87a24f89d39c826"},{"author":{"_account_id":7711,"name":"Yuriy Zveryanskyy","email":"yzveryanskyy@mirantis.com","username":"yuriyz"},"change_message_id":"126fb521e2af3f088c19089579ab04a0180ed57b","unresolved":false,"context_lines":[{"line_number":50,"context_line":"        errors \u003d []"},{"line_number":51,"context_line":"        try:"},{"line_number":52,"context_line":"            utils.validate_patch(patch)"},{"line_number":53,"context_line":"            patch \u003d jsonpatch.JsonPatch(patch)"},{"line_number":54,"context_line":"            old_obj \u003d self.as_dict()"},{"line_number":55,"context_line":"            new_obj \u003d jsonpatch.apply_patch(old_obj, patch)"},{"line_number":56,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATH%2F%2FwRk%3D","line":53,"updated":"2013-10-10 10:07:20.000000000","message":"If a patch is only used once, it is not necessary to create a patch object explicitly.\n\n\u003e\u003e\u003e obj \u003d {\u0027foo\u0027: \u0027bar\u0027}\n\n\u003e\u003e\u003e patch \u003d \u0027[{\"op\": \"add\", \"path\": \"/baz\", \"value\": \"qux\"}]\u0027\n\n\u003e\u003e\u003e res \u003d jsonpatch.apply_patch(obj, patch)","commit_id":"44e8a6a94cf7a834cfdde072f87a24f89d39c826"},{"author":{"_account_id":7711,"name":"Yuriy Zveryanskyy","email":"yzveryanskyy@mirantis.com","username":"yuriyz"},"change_message_id":"1c1386ca0e89f663b96c47eaa5b89d3781b4fc2d","unresolved":false,"context_lines":[{"line_number":70,"context_line":"                        if old_obj[key] !\u003d new_obj[key]:"},{"line_number":71,"context_line":"                            diff[key] \u003d new_obj[key]"},{"line_number":72,"context_line":"                    except Exception as e:"},{"line_number":73,"context_line":"                        print e"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"            errors \u003d self.validate_resource(new_obj)"},{"line_number":76,"context_line":"            return diff"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATH%2F%2Fzkg%3D","line":73,"updated":"2013-10-09 15:25:16.000000000","message":"This looks like workinprogress.","commit_id":"44e8a6a94cf7a834cfdde072f87a24f89d39c826"},{"author":{"_account_id":7625,"name":"Martyn Taylor","email":"mtaylor@redhat.com","username":"mtaylor"},"change_message_id":"2dc916b9409f9a91e03ceab0b9b729259d47117c","unresolved":false,"context_lines":[{"line_number":71,"context_line":"                            diff[key] \u003d new_obj[key]"},{"line_number":72,"context_line":"                    except Exception as e:"},{"line_number":73,"context_line":"                        print e"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"            errors \u003d self.validate_resource(new_obj)"},{"line_number":76,"context_line":"            return diff"},{"line_number":77,"context_line":"        except jsonpatch.JsonPatchException as jpe:"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATH%2F%2Fzgg%3D","line":74,"updated":"2013-10-09 15:34:48.000000000","message":"Ah this was left over debug code.  Thanks.","commit_id":"44e8a6a94cf7a834cfdde072f87a24f89d39c826"},{"author":{"_account_id":7711,"name":"Yuriy Zveryanskyy","email":"yzveryanskyy@mirantis.com","username":"yuriyz"},"change_message_id":"954b3cd7c86ef7ffdf90fc6a650df6c742757d60","unresolved":false,"context_lines":[{"line_number":72,"context_line":"                    except Exception as e:"},{"line_number":73,"context_line":"                        print e"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"            errors \u003d self.validate_resource(new_obj)"},{"line_number":76,"context_line":"            return diff"},{"line_number":77,"context_line":"        except jsonpatch.JsonPatchException as jpe:"},{"line_number":78,"context_line":"            errors.append(_(\"Patching Error: %s\") % jpe)"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATH%2F%2Fwio%3D","line":75,"updated":"2013-10-10 09:03:42.000000000","message":"Better do validate and raise after apply_patch and before restore defaults.","commit_id":"44e8a6a94cf7a834cfdde072f87a24f89d39c826"},{"author":{"_account_id":7625,"name":"Martyn Taylor","email":"mtaylor@redhat.com","username":"mtaylor"},"change_message_id":"75a40d0179308d67d49addaaa8e549de0b932b3e","unresolved":false,"context_lines":[{"line_number":72,"context_line":"                    except Exception as e:"},{"line_number":73,"context_line":"                        print e"},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"            errors \u003d self.validate_resource(new_obj)"},{"line_number":76,"context_line":"            return diff"},{"line_number":77,"context_line":"        except jsonpatch.JsonPatchException as jpe:"},{"line_number":78,"context_line":"            errors.append(_(\"Patching Error: %s\") % jpe)"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATH%2F%2Fv1k%3D","line":75,"in_reply_to":"AAAATH%2F%2Fwio%3D","updated":"2013-10-10 11:56:13.000000000","message":"This is intentional.  The validation is applied on the final state of the object which is after we restore defaults.","commit_id":"44e8a6a94cf7a834cfdde072f87a24f89d39c826"},{"author":{"_account_id":7711,"name":"Yuriy Zveryanskyy","email":"yzveryanskyy@mirantis.com","username":"yuriyz"},"change_message_id":"954b3cd7c86ef7ffdf90fc6a650df6c742757d60","unresolved":false,"context_lines":[{"line_number":88,"context_line":"        errors \u003d []"},{"line_number":89,"context_line":"        obj \u003d self.as_dict()"},{"line_number":90,"context_line":"        for attr, msg in self.blacklist().iteritems():"},{"line_number":91,"context_line":"            if obj[attr] !\u003d new_obj[attr]:"},{"line_number":92,"context_line":"                errors.add(msg or self.default_blacklist_message(attr))"},{"line_number":93,"context_line":"        return errors or True"},{"line_number":94,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATH%2F%2Fwj0%3D","line":91,"updated":"2013-10-10 09:03:42.000000000","message":"KeyError possible here if any of blacklisted attributes removed?\n\n1) Patch remove blacklisted attr l55.\n\n2) Blacklisted attr ignored l61.\n\n3) Oops here.","commit_id":"44e8a6a94cf7a834cfdde072f87a24f89d39c826"},{"author":{"_account_id":7711,"name":"Yuriy Zveryanskyy","email":"yzveryanskyy@mirantis.com","username":"yuriyz"},"change_message_id":"890033fef8ba22b0a5d91b421076b240323b0310","unresolved":false,"context_lines":[{"line_number":88,"context_line":"        errors \u003d []"},{"line_number":89,"context_line":"        obj \u003d self.as_dict()"},{"line_number":90,"context_line":"        for attr, msg in self.blacklist().iteritems():"},{"line_number":91,"context_line":"            if obj[attr] !\u003d new_obj[attr]:"},{"line_number":92,"context_line":"                errors.add(msg or self.default_blacklist_message(attr))"},{"line_number":93,"context_line":"        return errors or True"},{"line_number":94,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATH%2F%2FvmU%3D","line":91,"in_reply_to":"AAAATH%2F%2Fv1E%3D","updated":"2013-10-10 12:34:20.000000000","message":"I think more tests needed (for remove/change blacklisted attr, restore defaults).\n\nhttps://github.com/openstack/ironic/blob/master/ironic/tests/api/test_nodes.py#L172","commit_id":"44e8a6a94cf7a834cfdde072f87a24f89d39c826"},{"author":{"_account_id":7625,"name":"Martyn Taylor","email":"mtaylor@redhat.com","username":"mtaylor"},"change_message_id":"75a40d0179308d67d49addaaa8e549de0b932b3e","unresolved":false,"context_lines":[{"line_number":88,"context_line":"        errors \u003d []"},{"line_number":89,"context_line":"        obj \u003d self.as_dict()"},{"line_number":90,"context_line":"        for attr, msg in self.blacklist().iteritems():"},{"line_number":91,"context_line":"            if obj[attr] !\u003d new_obj[attr]:"},{"line_number":92,"context_line":"                errors.add(msg or self.default_blacklist_message(attr))"},{"line_number":93,"context_line":"        return errors or True"},{"line_number":94,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATH%2F%2Fv1E%3D","line":91,"in_reply_to":"AAAATH%2F%2Fwj0%3D","updated":"2013-10-10 11:56:13.000000000","message":"Nice catch.  I will update, cheers!","commit_id":"44e8a6a94cf7a834cfdde072f87a24f89d39c826"},{"author":{"_account_id":7711,"name":"Yuriy Zveryanskyy","email":"yzveryanskyy@mirantis.com","username":"yuriyz"},"change_message_id":"854a211e5083c6ec3df39bec4010732329400baf","unresolved":false,"context_lines":[{"line_number":39,"context_line":"        \"\"\"Returns a dict of blacklisted attributes with an associated error"},{"line_number":40,"context_line":"        message."},{"line_number":41,"context_line":"        \"\"\""},{"line_number":42,"context_line":"        common_blacklist \u003d {\"id\": None,"},{"line_number":43,"context_line":"                            \"links\": None,"},{"line_number":44,"context_line":"                            \"created_at\": None,"},{"line_number":45,"context_line":"                            \"updated_at\": None}"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2Fjx8%3D","line":42,"updated":"2013-10-14 15:37:26.000000000","message":"and uuid?","commit_id":"73489624a19f0da057cc63835feaacf2cab96379"},{"author":{"_account_id":2889,"name":"Aeva Black","email":"aeva.online@gmail.com","username":"tenbrae"},"change_message_id":"c66ef91e8c74e2129ef9c966f6d0f5fb5a341c55","unresolved":false,"context_lines":[{"line_number":39,"context_line":"        \"\"\"Returns a dict of blacklisted attributes with an associated error"},{"line_number":40,"context_line":"        message."},{"line_number":41,"context_line":"        \"\"\""},{"line_number":42,"context_line":"        common_blacklist \u003d {\"id\": None,"},{"line_number":43,"context_line":"                            \"links\": None,"},{"line_number":44,"context_line":"                            \"created_at\": None,"},{"line_number":45,"context_line":"                            \"updated_at\": None}"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2FjhI%3D","line":42,"in_reply_to":"AAAATH%2F%2Fjx8%3D","updated":"2013-10-14 15:56:01.000000000","message":"uuid is not a public attribute","commit_id":"73489624a19f0da057cc63835feaacf2cab96379"},{"author":{"_account_id":7711,"name":"Yuriy Zveryanskyy","email":"yzveryanskyy@mirantis.com","username":"yuriyz"},"change_message_id":"854a211e5083c6ec3df39bec4010732329400baf","unresolved":false,"context_lines":[{"line_number":71,"context_line":"            # Perform updates only on changed attributes}"},{"line_number":72,"context_line":"            diff \u003d {}"},{"line_number":73,"context_line":"            for key, value in new_obj.iteritems():"},{"line_number":74,"context_line":"                if key not in old_obj:"},{"line_number":75,"context_line":"                    diff[key] \u003d value"},{"line_number":76,"context_line":"                elif old_obj[key] !\u003d value:"},{"line_number":77,"context_line":"                    diff[key] \u003d value"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2Fj7c%3D","line":74,"updated":"2013-10-14 15:37:26.000000000","message":"we can add new keys? really?","commit_id":"73489624a19f0da057cc63835feaacf2cab96379"},{"author":{"_account_id":7625,"name":"Martyn Taylor","email":"mtaylor@redhat.com","username":"mtaylor"},"change_message_id":"dda4a0ec4624f53c31b497372e603cbd6cfc9dc7","unresolved":false,"context_lines":[{"line_number":71,"context_line":"            # Perform updates only on changed attributes}"},{"line_number":72,"context_line":"            diff \u003d {}"},{"line_number":73,"context_line":"            for key, value in new_obj.iteritems():"},{"line_number":74,"context_line":"                if key not in old_obj:"},{"line_number":75,"context_line":"                    diff[key] \u003d value"},{"line_number":76,"context_line":"                elif old_obj[key] !\u003d value:"},{"line_number":77,"context_line":"                    diff[key] \u003d value"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATn%2F%2Fs8M%3D","line":74,"in_reply_to":"AAAATH%2F%2Fj7c%3D","updated":"2013-10-30 08:21:10.000000000","message":"In some cases it is possible for the client to add new keys.  Like for example in the extras field.  This block is maintaining previous patch implementation behaviour.   Adding fields can be controlled via relevant validate_resource method for each object.","commit_id":"73489624a19f0da057cc63835feaacf2cab96379"},{"author":{"_account_id":2889,"name":"Aeva Black","email":"aeva.online@gmail.com","username":"tenbrae"},"change_message_id":"c66ef91e8c74e2129ef9c966f6d0f5fb5a341c55","unresolved":false,"context_lines":[{"line_number":77,"context_line":"                    diff[key] \u003d value"},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"            return diff"},{"line_number":80,"context_line":"        except jsonpatch.JsonPatchException as jpe:"},{"line_number":81,"context_line":"            raise exception.IronicException(_(\"Patching Error: %s\") % jpe)"},{"line_number":82,"context_line":""},{"line_number":83,"context_line":"    def blacklist_check(self, new_obj):"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2Fjgc%3D","line":80,"updated":"2013-10-14 15:56:01.000000000","message":"If the only thing which raises this exception is jsonpatch.apply_patch, then the try: block should be only around that call (or that code block), not everything in the method.","commit_id":"73489624a19f0da057cc63835feaacf2cab96379"},{"author":{"_account_id":7625,"name":"Martyn Taylor","email":"mtaylor@redhat.com","username":"mtaylor"},"change_message_id":"dda4a0ec4624f53c31b497372e603cbd6cfc9dc7","unresolved":false,"context_lines":[{"line_number":77,"context_line":"                    diff[key] \u003d value"},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"            return diff"},{"line_number":80,"context_line":"        except jsonpatch.JsonPatchException as jpe:"},{"line_number":81,"context_line":"            raise exception.IronicException(_(\"Patching Error: %s\") % jpe)"},{"line_number":82,"context_line":""},{"line_number":83,"context_line":"    def blacklist_check(self, new_obj):"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATn%2F%2Fs%2Bc%3D","line":80,"in_reply_to":"AAAATH%2F%2Fjgc%3D","updated":"2013-10-30 08:21:10.000000000","message":"This is more core styling.  The only place where JsonPatchException is thrown is indeed in the apply() method.  However, I do find that having many try, except statements inline makes the code less readible.  I find adding exception handling at the end of a block more intuitive.  Though I am more than happy to change this, if it is against Python (or Ironic) style policy.","commit_id":"73489624a19f0da057cc63835feaacf2cab96379"},{"author":{"_account_id":7711,"name":"Yuriy Zveryanskyy","email":"yzveryanskyy@mirantis.com","username":"yuriyz"},"change_message_id":"854a211e5083c6ec3df39bec4010732329400baf","unresolved":false,"context_lines":[{"line_number":78,"context_line":""},{"line_number":79,"context_line":"            return diff"},{"line_number":80,"context_line":"        except jsonpatch.JsonPatchException as jpe:"},{"line_number":81,"context_line":"            raise exception.IronicException(_(\"Patching Error: %s\") % jpe)"},{"line_number":82,"context_line":""},{"line_number":83,"context_line":"    def blacklist_check(self, new_obj):"},{"line_number":84,"context_line":"        \"\"\"Checks to see if any black listed attributes have been modified.\"\"\""}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2FjmU%3D","line":81,"updated":"2013-10-14 15:37:26.000000000","message":"please raise custom exception with code\u003d400","commit_id":"73489624a19f0da057cc63835feaacf2cab96379"},{"author":{"_account_id":7625,"name":"Martyn Taylor","email":"mtaylor@redhat.com","username":"mtaylor"},"change_message_id":"dda4a0ec4624f53c31b497372e603cbd6cfc9dc7","unresolved":false,"context_lines":[{"line_number":78,"context_line":""},{"line_number":79,"context_line":"            return diff"},{"line_number":80,"context_line":"        except jsonpatch.JsonPatchException as jpe:"},{"line_number":81,"context_line":"            raise exception.IronicException(_(\"Patching Error: %s\") % jpe)"},{"line_number":82,"context_line":""},{"line_number":83,"context_line":"    def blacklist_check(self, new_obj):"},{"line_number":84,"context_line":"        \"\"\"Checks to see if any black listed attributes have been modified.\"\"\""}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATn%2F%2Fs%2BQ%3D","line":81,"in_reply_to":"AAAATH%2F%2FjmU%3D","updated":"2013-10-30 08:21:10.000000000","message":"Will do thanks.","commit_id":"73489624a19f0da057cc63835feaacf2cab96379"},{"author":{"_account_id":7711,"name":"Yuriy Zveryanskyy","email":"yzveryanskyy@mirantis.com","username":"yuriyz"},"change_message_id":"854a211e5083c6ec3df39bec4010732329400baf","unresolved":false,"context_lines":[{"line_number":95,"context_line":"                errors.append(msg or self.default_blacklist_message(attr))"},{"line_number":96,"context_line":""},{"line_number":97,"context_line":"        if errors:"},{"line_number":98,"context_line":"            raise exception.IronicException(\", \".join(errors))"},{"line_number":99,"context_line":""},{"line_number":100,"context_line":"    def validate_resource(self, new_obj):"},{"line_number":101,"context_line":"        pass"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2FjuY%3D","line":98,"updated":"2013-10-14 15:37:26.000000000","message":"please raise custom exception with code\u003d400","commit_id":"73489624a19f0da057cc63835feaacf2cab96379"},{"author":{"_account_id":7625,"name":"Martyn Taylor","email":"mtaylor@redhat.com","username":"mtaylor"},"change_message_id":"dda4a0ec4624f53c31b497372e603cbd6cfc9dc7","unresolved":false,"context_lines":[{"line_number":95,"context_line":"                errors.append(msg or self.default_blacklist_message(attr))"},{"line_number":96,"context_line":""},{"line_number":97,"context_line":"        if errors:"},{"line_number":98,"context_line":"            raise exception.IronicException(\", \".join(errors))"},{"line_number":99,"context_line":""},{"line_number":100,"context_line":"    def validate_resource(self, new_obj):"},{"line_number":101,"context_line":"        pass"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATn%2F%2Fs9s%3D","line":98,"in_reply_to":"AAAATH%2F%2Fjek%3D","updated":"2013-10-30 08:21:10.000000000","message":"Sure.  Maybe there is a better way to handle this altogether in the API.  The desired output to the client would contain a list of invalid fields and an appropriate message to go with it.  This doesn\u0027t work great with exceptions.  For now I will do as you suggested.  Thanks","commit_id":"73489624a19f0da057cc63835feaacf2cab96379"},{"author":{"_account_id":2889,"name":"Aeva Black","email":"aeva.online@gmail.com","username":"tenbrae"},"change_message_id":"c66ef91e8c74e2129ef9c966f6d0f5fb5a341c55","unresolved":false,"context_lines":[{"line_number":95,"context_line":"                errors.append(msg or self.default_blacklist_message(attr))"},{"line_number":96,"context_line":""},{"line_number":97,"context_line":"        if errors:"},{"line_number":98,"context_line":"            raise exception.IronicException(\", \".join(errors))"},{"line_number":99,"context_line":""},{"line_number":100,"context_line":"    def validate_resource(self, new_obj):"},{"line_number":101,"context_line":"        pass"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2Fjek%3D","line":98,"in_reply_to":"AAAATH%2F%2FjuY%3D","updated":"2013-10-14 15:56:01.000000000","message":"also, a comma-separated string of error messages does not seem appropriate to me. A single message which lists the requested-but-not-modifiable attributes would be better, eg, \n\n  raise exception.AttributeError(_(\n    \"Unable to modify the following attribute(s): %s\") % \", \".join(errors))","commit_id":"73489624a19f0da057cc63835feaacf2cab96379"}],"ironic/api/controllers/v1/node.py":[{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"b1b40f39fe95cd35a5e5f663baf07777316f35ab","unresolved":false,"context_lines":[{"line_number":181,"context_line":""},{"line_number":182,"context_line":"        #TODO(mtaylor):Add i18n support for messages"},{"line_number":183,"context_line":"        state_message \u003d \u0027Changing states is not allowed here; You must use the\\"},{"line_number":184,"context_line":" nodes/%s/state interface\u0027 % self.uuid"},{"line_number":185,"context_line":""},{"line_number":186,"context_line":"        # Setting the value to None forces use of default message"},{"line_number":187,"context_line":"        return {\u0027id\u0027: None,"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAS3%2F%2FI%2F8%3D","line":184,"updated":"2013-10-03 16:35:31.000000000","message":"Also, when adding the i18n you don\u0027t need to use the \u0027 \\ \u0027 to break the message, just do like:\n\nstate_message \u003d _(\u0027Changing states is not allowed here; You must use the \u0027\n                  \u0027nodes/%s/state interface\u0027) % self.uuid","commit_id":"be52d0883817d1b42bfed96df0a0671b2d18c5e8"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"b1b40f39fe95cd35a5e5f663baf07777316f35ab","unresolved":false,"context_lines":[{"line_number":286,"context_line":"        if any(getattr(self, tgt) for tgt in [\"target_power_state\","},{"line_number":287,"context_line":"                                              \"target_provision_state\"]):"},{"line_number":288,"context_line":"            errors.append(\"Can not update node %s because a state change is \\"},{"line_number":289,"context_line":"already in progress.\" % self.uuid)"},{"line_number":290,"context_line":""},{"line_number":291,"context_line":"        if errors:"},{"line_number":292,"context_line":"            raise wsme.exc.ClientSideError(\", \".join(errors))"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAS3%2F%2FI%2Fo%3D","line":289,"updated":"2013-10-03 16:35:31.000000000","message":"same as on line 184","commit_id":"be52d0883817d1b42bfed96df0a0671b2d18c5e8"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"cbd174f018fe4973042e6114508b74d0180da6a5","unresolved":false,"context_lines":[{"line_number":379,"context_line":"        \"\"\"Retrieve information about the given node.\"\"\""},{"line_number":380,"context_line":""},{"line_number":381,"context_line":"        rpc_node \u003d objects.Node.get_by_uuid(pecan.request.context, uuid)"},{"line_number":382,"context_line":"        return Node.convert_with_links(rpc_node)"},{"line_number":383,"context_line":""},{"line_number":384,"context_line":"    def _convert_chassis_uuid_to_id(self, node_dict):"},{"line_number":385,"context_line":"        # NOTE(lucasagomes): translate uuid -\u003e id, used internally to"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAATH%2F%2F8jg%3D","line":382,"updated":"2013-10-07 16:40:18.000000000","message":"I don\u0027t like much the idea of this method returning a converted object with links.\n\nIn the patch() method for i.e, the convert_with_links() is being called twice. One before applying the patch and then again before returning the new_node. IMO the first call should be a node.as_dict() and not convert_with_links().\n\nI think we could get rid of this method.","commit_id":"eb497ec506c572815d267869b97ee12b03fffd44"},{"author":{"_account_id":7625,"name":"Martyn Taylor","email":"mtaylor@redhat.com","username":"mtaylor"},"change_message_id":"fba5d54aef2d682a5a0d91082789efcea72a9fc0","unresolved":false,"context_lines":[{"line_number":379,"context_line":"        \"\"\"Retrieve information about the given node.\"\"\""},{"line_number":380,"context_line":""},{"line_number":381,"context_line":"        rpc_node \u003d objects.Node.get_by_uuid(pecan.request.context, uuid)"},{"line_number":382,"context_line":"        return Node.convert_with_links(rpc_node)"},{"line_number":383,"context_line":""},{"line_number":384,"context_line":"    def _convert_chassis_uuid_to_id(self, node_dict):"},{"line_number":385,"context_line":"        # NOTE(lucasagomes): translate uuid -\u003e id, used internally to"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAATH%2F%2F6A4%3D","line":382,"in_reply_to":"AAAATH%2F%2F8jg%3D","updated":"2013-10-08 08:31:50.000000000","message":"Yeah I agree.  We should not be calling convert with links twice.  The key thing here though is that we are returning a WSME object and not an RPC Object.  Since updates are relative to the WSME type (since this is what the user sees).  I will rework this to remove the convert_with_links stuff.\n\nThanks","commit_id":"eb497ec506c572815d267869b97ee12b03fffd44"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"cbd174f018fe4973042e6114508b74d0180da6a5","unresolved":false,"context_lines":[{"line_number":449,"context_line":""},{"line_number":450,"context_line":"        try:"},{"line_number":451,"context_line":"            if self._from_chassis:"},{"line_number":452,"context_line":"                raise exception.OperationNotPermitted"},{"line_number":453,"context_line":""},{"line_number":454,"context_line":"            node \u003d self._get_node(uuid)"},{"line_number":455,"context_line":"            diff \u003d node.patch(patch)"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAATH%2F%2F8jQ%3D","line":452,"updated":"2013-10-07 16:40:18.000000000","message":"I think it should go outside the try/except block, just like the other methods.","commit_id":"eb497ec506c572815d267869b97ee12b03fffd44"},{"author":{"_account_id":7625,"name":"Martyn Taylor","email":"mtaylor@redhat.com","username":"mtaylor"},"change_message_id":"fba5d54aef2d682a5a0d91082789efcea72a9fc0","unresolved":false,"context_lines":[{"line_number":449,"context_line":""},{"line_number":450,"context_line":"        try:"},{"line_number":451,"context_line":"            if self._from_chassis:"},{"line_number":452,"context_line":"                raise exception.OperationNotPermitted"},{"line_number":453,"context_line":""},{"line_number":454,"context_line":"            node \u003d self._get_node(uuid)"},{"line_number":455,"context_line":"            diff \u003d node.patch(patch)"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAATH%2F%2F5%2Bs%3D","line":452,"in_reply_to":"AAAATH%2F%2F8jQ%3D","updated":"2013-10-08 08:31:50.000000000","message":"This was intentional.  We raise the exception then allow it to be caught and handled appropriately using: `excutils.save_and_reraise_exception()`","commit_id":"eb497ec506c572815d267869b97ee12b03fffd44"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"cbd174f018fe4973042e6114508b74d0180da6a5","unresolved":false,"context_lines":[{"line_number":455,"context_line":"            diff \u003d node.patch(patch)"},{"line_number":456,"context_line":"            node \u003d pecan.request.rpcapi.update_node(pecan.request.context,"},{"line_number":457,"context_line":"                                                    diff)"},{"line_number":458,"context_line":"            return Node.convert_with_links(node)"},{"line_number":459,"context_line":""},{"line_number":460,"context_line":"        except exception.IronicException as e:"},{"line_number":461,"context_line":"            with excutils.save_and_reraise_exception():"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAATH%2F%2F8jM%3D","line":458,"updated":"2013-10-07 16:40:18.000000000","message":"Also would put outside the try/except block","commit_id":"eb497ec506c572815d267869b97ee12b03fffd44"},{"author":{"_account_id":7711,"name":"Yuriy Zveryanskyy","email":"yzveryanskyy@mirantis.com","username":"yuriyz"},"change_message_id":"954b3cd7c86ef7ffdf90fc6a650df6c742757d60","unresolved":false,"context_lines":[{"line_number":279,"context_line":"        errors \u003d []"},{"line_number":280,"context_line":"        try:"},{"line_number":281,"context_line":"            super(Node, self).validate_resource(new_obj)"},{"line_number":282,"context_line":"        except wsme.exc.ClientSideError as e:"},{"line_number":283,"context_line":"            errors \u003d [e.message]"},{"line_number":284,"context_line":""},{"line_number":285,"context_line":"        if any(getattr(self, tgt) for tgt in [\"target_power_state\","}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATH%2F%2Fwgk%3D","line":282,"updated":"2013-10-10 09:03:42.000000000","message":"wsme.exc.ClientSideError intended for wsme. We must use custom Ironic exception here.","commit_id":"44e8a6a94cf7a834cfdde072f87a24f89d39c826"},{"author":{"_account_id":7625,"name":"Martyn Taylor","email":"mtaylor@redhat.com","username":"mtaylor"},"change_message_id":"75a40d0179308d67d49addaaa8e549de0b932b3e","unresolved":false,"context_lines":[{"line_number":279,"context_line":"        errors \u003d []"},{"line_number":280,"context_line":"        try:"},{"line_number":281,"context_line":"            super(Node, self).validate_resource(new_obj)"},{"line_number":282,"context_line":"        except wsme.exc.ClientSideError as e:"},{"line_number":283,"context_line":"            errors \u003d [e.message]"},{"line_number":284,"context_line":""},{"line_number":285,"context_line":"        if any(getattr(self, tgt) for tgt in [\"target_power_state\","}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATH%2F%2Fv0w%3D","line":282,"in_reply_to":"AAAATH%2F%2Fwgk%3D","updated":"2013-10-10 11:56:13.000000000","message":"Yes. Thanks I will change.","commit_id":"44e8a6a94cf7a834cfdde072f87a24f89d39c826"},{"author":{"_account_id":7711,"name":"Yuriy Zveryanskyy","email":"yzveryanskyy@mirantis.com","username":"yuriyz"},"change_message_id":"954b3cd7c86ef7ffdf90fc6a650df6c742757d60","unresolved":false,"context_lines":[{"line_number":280,"context_line":"        try:"},{"line_number":281,"context_line":"            super(Node, self).validate_resource(new_obj)"},{"line_number":282,"context_line":"        except wsme.exc.ClientSideError as e:"},{"line_number":283,"context_line":"            errors \u003d [e.message]"},{"line_number":284,"context_line":""},{"line_number":285,"context_line":"        if any(getattr(self, tgt) for tgt in [\"target_power_state\","},{"line_number":286,"context_line":"                                              \"target_provision_state\"]):"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATH%2F%2Fwf4%3D","line":283,"updated":"2013-10-10 09:03:42.000000000","message":"\u0027message\u0027 attribute OK for IronicException, otherwise IMO this is undocumented and Python 2 specific.","commit_id":"44e8a6a94cf7a834cfdde072f87a24f89d39c826"},{"author":{"_account_id":6773,"name":"Lucas Alvares Gomes","email":"lucasagomes@gmail.com","username":"lucasagomes"},"change_message_id":"6f4ba20d894672a1e38659844579e9d272d25bcb","unresolved":false,"context_lines":[{"line_number":280,"context_line":"        try:"},{"line_number":281,"context_line":"            super(Node, self).validate_resource(new_obj)"},{"line_number":282,"context_line":"        except wsme.exc.ClientSideError as e:"},{"line_number":283,"context_line":"            errors \u003d [e.message]"},{"line_number":284,"context_line":""},{"line_number":285,"context_line":"        if any(getattr(self, tgt) for tgt in [\"target_power_state\","},{"line_number":286,"context_line":"                                              \"target_provision_state\"]):"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATH%2F%2FzK8%3D","line":283,"updated":"2013-10-09 17:07:29.000000000","message":"the validate_resource() on the base class always have to be called because it does the basic (generic) validation of the patch, right?\n\nIf so, I think that it should be implicit, we don\u0027t need to call it explicitly like this.\n\nSomething like:\n\nclass Base(object):\n\n    # custom method for patch validation that should be\n    # implemented on the inherited classes\n    def _validate_resource(self, new_obj):\n        pass\n\n    def validate_resource(self, new_obj):\n\t...\n        do generic validation\n        ...\n\n        # calls the custom validation\n        self._validate_resource(new_obj)\n\n\n\nclass Resource(Base):\n\n    def _validate_resource(self, new_obj):\n        ...\n        do custom validation\n        ...","commit_id":"44e8a6a94cf7a834cfdde072f87a24f89d39c826"},{"author":{"_account_id":7625,"name":"Martyn Taylor","email":"mtaylor@redhat.com","username":"mtaylor"},"change_message_id":"75a40d0179308d67d49addaaa8e549de0b932b3e","unresolved":false,"context_lines":[{"line_number":280,"context_line":"        try:"},{"line_number":281,"context_line":"            super(Node, self).validate_resource(new_obj)"},{"line_number":282,"context_line":"        except wsme.exc.ClientSideError as e:"},{"line_number":283,"context_line":"            errors \u003d [e.message]"},{"line_number":284,"context_line":""},{"line_number":285,"context_line":"        if any(getattr(self, tgt) for tgt in [\"target_power_state\","},{"line_number":286,"context_line":"                                              \"target_provision_state\"]):"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATH%2F%2Fv3g%3D","line":283,"in_reply_to":"AAAATH%2F%2Fwf4%3D","updated":"2013-10-10 11:56:13.000000000","message":"Ah yes thanks for pointing that out I didn\u0027t realise this was Python 2 specific.  Cheers.","commit_id":"44e8a6a94cf7a834cfdde072f87a24f89d39c826"},{"author":{"_account_id":7625,"name":"Martyn Taylor","email":"mtaylor@redhat.com","username":"mtaylor"},"change_message_id":"75a40d0179308d67d49addaaa8e549de0b932b3e","unresolved":false,"context_lines":[{"line_number":280,"context_line":"        try:"},{"line_number":281,"context_line":"            super(Node, self).validate_resource(new_obj)"},{"line_number":282,"context_line":"        except wsme.exc.ClientSideError as e:"},{"line_number":283,"context_line":"            errors \u003d [e.message]"},{"line_number":284,"context_line":""},{"line_number":285,"context_line":"        if any(getattr(self, tgt) for tgt in [\"target_power_state\","},{"line_number":286,"context_line":"                                              \"target_provision_state\"]):"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAATH%2F%2Fv88%3D","line":283,"in_reply_to":"AAAATH%2F%2FzK8%3D","updated":"2013-10-10 11:56:13.000000000","message":"My thinking here was that the default validation (was well... default) and you could override it in anything that extends base.  In the case of node we want to extend the default behaviour.  So we call super then append any extra messages to the errors.\n\nFor the case of blacklisting, it maybe that we want to pull this behaviour into some security_check method or something similar?","commit_id":"44e8a6a94cf7a834cfdde072f87a24f89d39c826"},{"author":{"_account_id":7711,"name":"Yuriy Zveryanskyy","email":"yzveryanskyy@mirantis.com","username":"yuriyz"},"change_message_id":"854a211e5083c6ec3df39bec4010732329400baf","unresolved":false,"context_lines":[{"line_number":279,"context_line":"            errors.append(_(\"Can not update node %s because a state change is \""},{"line_number":280,"context_line":"                            \"already in progress.\") % self.uuid)"},{"line_number":281,"context_line":"        if errors:"},{"line_number":282,"context_line":"            raise exception.IronicException(\", \".join(errors))"},{"line_number":283,"context_line":""},{"line_number":284,"context_line":""},{"line_number":285,"context_line":"class NodeCollection(collection.Collection):"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2FjuI%3D","line":282,"updated":"2013-10-14 15:37:26.000000000","message":"please raise custom exception with code\u003d400","commit_id":"73489624a19f0da057cc63835feaacf2cab96379"},{"author":{"_account_id":7625,"name":"Martyn Taylor","email":"mtaylor@redhat.com","username":"mtaylor"},"change_message_id":"dda4a0ec4624f53c31b497372e603cbd6cfc9dc7","unresolved":false,"context_lines":[{"line_number":279,"context_line":"            errors.append(_(\"Can not update node %s because a state change is \""},{"line_number":280,"context_line":"                            \"already in progress.\") % self.uuid)"},{"line_number":281,"context_line":"        if errors:"},{"line_number":282,"context_line":"            raise exception.IronicException(\", \".join(errors))"},{"line_number":283,"context_line":""},{"line_number":284,"context_line":""},{"line_number":285,"context_line":"class NodeCollection(collection.Collection):"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2FjUA%3D","line":282,"in_reply_to":"AAAATH%2F%2Fjdo%3D","updated":"2013-10-30 08:21:10.000000000","message":"I am happy to change this if there is a strong resistance.  But the idea here is that error messages are configurable.  For example, if you incorrectly modify the power_state and the ID.  Two different messages would be returned.  \n\n\"Error \u0027id\u0027\u0027 is not modifiable\"\n\"Error the power state \u0027REBOOTING\u0027 is not a valid power state, these are: \"ON\", \"OFF\"\n\nThis gives the client more information so that they can generate a valid subsequent request.","commit_id":"73489624a19f0da057cc63835feaacf2cab96379"},{"author":{"_account_id":2889,"name":"Aeva Black","email":"aeva.online@gmail.com","username":"tenbrae"},"change_message_id":"c66ef91e8c74e2129ef9c966f6d0f5fb5a341c55","unresolved":false,"context_lines":[{"line_number":279,"context_line":"            errors.append(_(\"Can not update node %s because a state change is \""},{"line_number":280,"context_line":"                            \"already in progress.\") % self.uuid)"},{"line_number":281,"context_line":"        if errors:"},{"line_number":282,"context_line":"            raise exception.IronicException(\", \".join(errors))"},{"line_number":283,"context_line":""},{"line_number":284,"context_line":""},{"line_number":285,"context_line":"class NodeCollection(collection.Collection):"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2Fjdo%3D","line":282,"in_reply_to":"AAAATH%2F%2FjuI%3D","updated":"2013-10-14 15:56:01.000000000","message":"comma-separated list of error messages should be replaced with a single error message that appends a comma-separated list of offending attributes.","commit_id":"73489624a19f0da057cc63835feaacf2cab96379"},{"author":{"_account_id":7711,"name":"Yuriy Zveryanskyy","email":"yzveryanskyy@mirantis.com","username":"yuriyz"},"change_message_id":"854a211e5083c6ec3df39bec4010732329400baf","unresolved":false,"context_lines":[{"line_number":371,"context_line":"        \"\"\"Retrieve information about the given node.\"\"\""},{"line_number":372,"context_line":""},{"line_number":373,"context_line":"        rpc_node \u003d objects.Node.get_by_uuid(pecan.request.context, uuid)"},{"line_number":374,"context_line":"        return Node.convert_with_links(rpc_node)"},{"line_number":375,"context_line":""},{"line_number":376,"context_line":"    def _convert_chassis_uuid_to_id(self, node_dict):"},{"line_number":377,"context_line":"        # NOTE(lucasagomes): translate uuid -\u003e id, used internally to"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2Fjss%3D","line":374,"updated":"2013-10-14 15:37:26.000000000","message":"Why we do convert_with_links() here?","commit_id":"73489624a19f0da057cc63835feaacf2cab96379"},{"author":{"_account_id":7625,"name":"Martyn Taylor","email":"mtaylor@redhat.com","username":"mtaylor"},"change_message_id":"dda4a0ec4624f53c31b497372e603cbd6cfc9dc7","unresolved":false,"context_lines":[{"line_number":371,"context_line":"        \"\"\"Retrieve information about the given node.\"\"\""},{"line_number":372,"context_line":""},{"line_number":373,"context_line":"        rpc_node \u003d objects.Node.get_by_uuid(pecan.request.context, uuid)"},{"line_number":374,"context_line":"        return Node.convert_with_links(rpc_node)"},{"line_number":375,"context_line":""},{"line_number":376,"context_line":"    def _convert_chassis_uuid_to_id(self, node_dict):"},{"line_number":377,"context_line":"        # NOTE(lucasagomes): translate uuid -\u003e id, used internally to"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2FjU8%3D","line":374,"in_reply_to":"AAAATH%2F%2Fjss%3D","updated":"2013-10-30 08:21:10.000000000","message":"This is a helper method for looking up a node and converting it to an API resource.  \n\nWhen we apply updates to resources we should be apply these update to the resource that the client sees (not the internal database object).   convert_with_links is the method that generates the resource as the client sees it (i.e. the API representation of the resource).","commit_id":"73489624a19f0da057cc63835feaacf2cab96379"},{"author":{"_account_id":7711,"name":"Yuriy Zveryanskyy","email":"yzveryanskyy@mirantis.com","username":"yuriyz"},"change_message_id":"854a211e5083c6ec3df39bec4010732329400baf","unresolved":false,"context_lines":[{"line_number":446,"context_line":"            node \u003d self._get_node(uuid)"},{"line_number":447,"context_line":"            diff \u003d node.patch(patch)"},{"line_number":448,"context_line":"            node \u003d pecan.request.rpcapi.update_node(pecan.request.context,"},{"line_number":449,"context_line":"                                                    diff)"},{"line_number":450,"context_line":"            return Node.convert_with_links(node)"},{"line_number":451,"context_line":""},{"line_number":452,"context_line":"        except exception.IronicException as e:"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2FjmM%3D","line":449,"updated":"2013-10-14 15:37:26.000000000","message":"node_obj must be here, not a dict","commit_id":"73489624a19f0da057cc63835feaacf2cab96379"}]}
