)]}'
{"bin/agent":[{"author":{"_account_id":406,"name":"Mike Scherbakov","email":"mihgen@gmail.com","username":"mihgen"},"change_message_id":"c1e9d4ece2e8813b25d369244d1033bb9db09db0","unresolved":false,"context_lines":[{"line_number":136,"context_line":"    res \u003d htclient.put(\"#{@api_url}/nodes/agent/\", [_data].to_json, headers)"},{"line_number":137,"context_line":"    @logger.debug(\"Response: status: #{res.status} body: #{res.body}\")"},{"line_number":138,"context_line":"    if res.status \u003c 200 or res.status \u003e\u003d 300"},{"line_number":139,"context_line":"      @logger.error(\"HTTP PUT failed: #{res.inspect}\")"},{"line_number":140,"context_line":"    end"},{"line_number":141,"context_line":"    res"},{"line_number":142,"context_line":"  end"}],"source_content_type":"application/octet-stream","patch_set":18,"id":"AAAAUX%2F%2Befk%3D","line":139,"updated":"2014-02-20 23:34:43.000000000","message":"304 is normal status now, but agents prints error message. It must be fixed, or this line is removed completely (but let\u0027s make sure error is still caught and logged somewhere with all required details)","commit_id":"c56875779ffc3c310c6f861c3832ee8d57b4282f"},{"author":{"_account_id":406,"name":"Mike Scherbakov","email":"mihgen@gmail.com","username":"mihgen"},"change_message_id":"c1e9d4ece2e8813b25d369244d1033bb9db09db0","unresolved":false,"context_lines":[{"line_number":512,"context_line":"  logger.info(\"Could not get url from configuration file: #{e.message}, trying other ways..\")"},{"line_number":513,"context_line":"end"},{"line_number":514,"context_line":""},{"line_number":515,"context_line":"sleep_time \u003d rand(30)"},{"line_number":516,"context_line":"logger.debug(\"Sleep for #{sleep_time} seconds before sending request\")"},{"line_number":517,"context_line":"sleep(sleep_time)"},{"line_number":518,"context_line":""}],"source_content_type":"application/octet-stream","patch_set":18,"id":"AAAAUX%2F%2Beeo%3D","line":515,"updated":"2014-02-20 23:34:43.000000000","message":"This sends updates too often, I believe. Can we do 60 + rand(30) instead, for example? Would it be sufficient? Did we run any tests that emulate high load from agents to nailgun?","commit_id":"c56875779ffc3c310c6f861c3832ee8d57b4282f"},{"author":{"_account_id":8797,"name":"Andrew Woodward","email":"xarses@gmail.com","username":"xarses"},"change_message_id":"e85b8a99ff4b2ce1b09f272f3730b7f7eb88fadf","unresolved":false,"context_lines":[{"line_number":512,"context_line":"  logger.info(\"Could not get url from configuration file: #{e.message}, trying other ways..\")"},{"line_number":513,"context_line":"end"},{"line_number":514,"context_line":""},{"line_number":515,"context_line":"sleep_time \u003d rand(30)"},{"line_number":516,"context_line":"logger.debug(\"Sleep for #{sleep_time} seconds before sending request\")"},{"line_number":517,"context_line":"sleep(sleep_time)"},{"line_number":518,"context_line":""}],"source_content_type":"application/octet-stream","patch_set":18,"id":"AAAAUX%2F%2Bec0%3D","line":515,"in_reply_to":"AAAAUX%2F%2Beeo%3D","updated":"2014-02-21 20:07:27.000000000","message":"The cronjob is every minute so it is 60 + rand(30)","commit_id":"c56875779ffc3c310c6f861c3832ee8d57b4282f"},{"author":{"_account_id":406,"name":"Mike Scherbakov","email":"mihgen@gmail.com","username":"mihgen"},"change_message_id":"c1e9d4ece2e8813b25d369244d1033bb9db09db0","unresolved":false,"context_lines":[{"line_number":527,"context_line":"    mc_config.replace_identity(new_id)"},{"line_number":528,"context_line":"    write_data_to_file(logger, \u0027/etc/nailgun_uid\u0027, new_id.to_s)"},{"line_number":529,"context_line":"  elsif put_res.status \u003d\u003d 304"},{"line_number":530,"context_line":"    exit 1"},{"line_number":531,"context_line":"  else"},{"line_number":532,"context_line":"    logger.error put_res.body"},{"line_number":533,"context_line":"    exit 1"}],"source_content_type":"application/octet-stream","patch_set":18,"id":"AAAAUX%2F%2Bfkc%3D","line":530,"updated":"2014-02-20 23:34:43.000000000","message":"304 code is normal behavior, why do we exit with 1?","commit_id":"c56875779ffc3c310c6f861c3832ee8d57b4282f"}],"nailgun/nailgun/api/handlers/node.py":[{"author":{"_account_id":8749,"name":"Evgeniy L","email":"eli@mirantis.com","username":"evgeniyl"},"change_message_id":"0969bf65183d1d8bcb634169bdcbb4ac017e6bf9","unresolved":false,"context_lines":[{"line_number":402,"context_line":""},{"line_number":403,"context_line":"        node_data \u003d self.checked_data("},{"line_number":404,"context_line":"            self.validator.validate_collection_update"},{"line_number":405,"context_line":"        )[0]"},{"line_number":406,"context_line":""},{"line_number":407,"context_line":"        # caching by simply hashing raw put data from node"},{"line_number":408,"context_line":"        node_data[\u0027cached\u0027] \u003d hashlib.sha1(web.data()).hexdigest()"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAUH%2F9pVw%3D","line":405,"updated":"2014-02-05 13:09:52.000000000","message":"If we accept a list for this handler, then we need to update all nodes in this list. Or we can just accept json-hash here instead of list.","commit_id":"d60386740aeb4dbfe42e7fa02876523ee5f34451"},{"author":{"_account_id":8749,"name":"Evgeniy L","email":"eli@mirantis.com","username":"evgeniyl"},"change_message_id":"a3f6c05eae8a992e72df6557110079a4350d2b48","unresolved":false,"context_lines":[{"line_number":402,"context_line":""},{"line_number":403,"context_line":"        node_data \u003d self.checked_data("},{"line_number":404,"context_line":"            self.validator.validate_collection_update"},{"line_number":405,"context_line":"        )[0]"},{"line_number":406,"context_line":""},{"line_number":407,"context_line":"        # caching by simply hashing raw put data from node"},{"line_number":408,"context_line":"        node_data[\u0027cached\u0027] \u003d hashlib.sha1(web.data()).hexdigest()"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAUH%2F9gSQ%3D","line":405,"in_reply_to":"AAAAUH%2F9ogg%3D","updated":"2014-02-07 09:09:15.000000000","message":"It\u0027s a wrong interface, if handler accepts a list of data, we should update node for each element.","commit_id":"d60386740aeb4dbfe42e7fa02876523ee5f34451"},{"author":{"_account_id":10212,"name":"Dmitry Sokolov","email":"dsokolov@mirantis.com","username":"demon.mhm"},"change_message_id":"d1afe8b7cb072479f00b19d807b88b6dbacc51f9","unresolved":false,"context_lines":[{"line_number":402,"context_line":""},{"line_number":403,"context_line":"        node_data \u003d self.checked_data("},{"line_number":404,"context_line":"            self.validator.validate_collection_update"},{"line_number":405,"context_line":"        )[0]"},{"line_number":406,"context_line":""},{"line_number":407,"context_line":"        # caching by simply hashing raw put data from node"},{"line_number":408,"context_line":"        node_data[\u0027cached\u0027] \u003d hashlib.sha1(web.data()).hexdigest()"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAUH%2F9ogg%3D","line":405,"in_reply_to":"AAAAUH%2F9pVw%3D","updated":"2014-02-05 14:38:10.000000000","message":"We always accept list with one node in it from agent. Thus we update all nodes in list. And we cant accept json-hash here, because we need to parse node id to get comparable hash from db","commit_id":"d60386740aeb4dbfe42e7fa02876523ee5f34451"},{"author":{"_account_id":8749,"name":"Evgeniy L","email":"eli@mirantis.com","username":"evgeniyl"},"change_message_id":"0969bf65183d1d8bcb634169bdcbb4ac017e6bf9","unresolved":false,"context_lines":[{"line_number":405,"context_line":"        )[0]"},{"line_number":406,"context_line":""},{"line_number":407,"context_line":"        # caching by simply hashing raw put data from node"},{"line_number":408,"context_line":"        node_data[\u0027cached\u0027] \u003d hashlib.sha1(web.data()).hexdigest()"},{"line_number":409,"context_line":""},{"line_number":410,"context_line":"        try:"},{"line_number":411,"context_line":"            status, node \u003d self.update_node_state(node_data, True)"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAUH%2F9pSs%3D","line":408,"updated":"2014-02-05 13:09:52.000000000","message":"web.data() - is a string, json serializers can serialize hash with any key order.","commit_id":"d60386740aeb4dbfe42e7fa02876523ee5f34451"},{"author":{"_account_id":8749,"name":"Evgeniy L","email":"eli@mirantis.com","username":"evgeniyl"},"change_message_id":"a3f6c05eae8a992e72df6557110079a4350d2b48","unresolved":false,"context_lines":[{"line_number":405,"context_line":"        )[0]"},{"line_number":406,"context_line":""},{"line_number":407,"context_line":"        # caching by simply hashing raw put data from node"},{"line_number":408,"context_line":"        node_data[\u0027cached\u0027] \u003d hashlib.sha1(web.data()).hexdigest()"},{"line_number":409,"context_line":""},{"line_number":410,"context_line":"        try:"},{"line_number":411,"context_line":"            status, node \u003d self.update_node_state(node_data, True)"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAUH%2F9gRQ%3D","line":408,"in_reply_to":"AAAAUH%2F9oc8%3D","updated":"2014-02-07 09:09:15.000000000","message":"Ok, maybe you are right.","commit_id":"d60386740aeb4dbfe42e7fa02876523ee5f34451"},{"author":{"_account_id":10212,"name":"Dmitry Sokolov","email":"dsokolov@mirantis.com","username":"demon.mhm"},"change_message_id":"d1afe8b7cb072479f00b19d807b88b6dbacc51f9","unresolved":false,"context_lines":[{"line_number":405,"context_line":"        )[0]"},{"line_number":406,"context_line":""},{"line_number":407,"context_line":"        # caching by simply hashing raw put data from node"},{"line_number":408,"context_line":"        node_data[\u0027cached\u0027] \u003d hashlib.sha1(web.data()).hexdigest()"},{"line_number":409,"context_line":""},{"line_number":410,"context_line":"        try:"},{"line_number":411,"context_line":"            status, node \u003d self.update_node_state(node_data, True)"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAUH%2F9oc8%3D","line":408,"in_reply_to":"AAAAUH%2F9pSs%3D","updated":"2014-02-05 14:38:10.000000000","message":"That\u0027s a point. I assume that node will serialize same dataset in same string in unchanging conditions. If even keys ordering are changed - that means something changed in data and we have to update db. Anyways I think this cheap and cursory check is trustworthy instead of parsing string and generate order-independent hash.","commit_id":"d60386740aeb4dbfe42e7fa02876523ee5f34451"},{"author":{"_account_id":8749,"name":"Evgeniy L","email":"eli@mirantis.com","username":"evgeniyl"},"change_message_id":"0969bf65183d1d8bcb634169bdcbb4ac017e6bf9","unresolved":false,"context_lines":[{"line_number":410,"context_line":"        try:"},{"line_number":411,"context_line":"            status, node \u003d self.update_node_state(node_data, True)"},{"line_number":412,"context_line":"        except Exception:"},{"line_number":413,"context_line":"            status, node \u003d self.register_node(node_data)"},{"line_number":414,"context_line":""},{"line_number":415,"context_line":"        node.timestamp \u003d datetime.now()"},{"line_number":416,"context_line":"        if not node.online:"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAUH%2F9o%2BA%3D","line":413,"updated":"2014-02-05 13:09:52.000000000","message":"Lets make this logic explicitly.\n\n1. move node retrieving logic to separate method, we will be able just call get_node(meta) and receive node object from db.\n\n2. get_node should return None in case if node wasn\u0027t found, and in this case we should call register_node(meta)\n\n3. create separate method does_node_update_required returns True in case if meta was changed and False if wasn\u0027t\n\n4. in case if get_node returned model and does_node_update_required returned True we can run update_node_state, and update all required models","commit_id":"d60386740aeb4dbfe42e7fa02876523ee5f34451"},{"author":{"_account_id":10212,"name":"Dmitry Sokolov","email":"dsokolov@mirantis.com","username":"demon.mhm"},"change_message_id":"d1afe8b7cb072479f00b19d807b88b6dbacc51f9","unresolved":false,"context_lines":[{"line_number":410,"context_line":"        try:"},{"line_number":411,"context_line":"            status, node \u003d self.update_node_state(node_data, True)"},{"line_number":412,"context_line":"        except Exception:"},{"line_number":413,"context_line":"            status, node \u003d self.register_node(node_data)"},{"line_number":414,"context_line":""},{"line_number":415,"context_line":"        node.timestamp \u003d datetime.now()"},{"line_number":416,"context_line":"        if not node.online:"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAUH%2F9oWw%3D","line":413,"in_reply_to":"AAAAUH%2F9o%2BA%3D","updated":"2014-02-05 14:38:10.000000000","message":"This make sence. But do we really need to re-factor this logic within the frame of this task? We have discussed moving business logic into objects - that\u0027s the place for it","commit_id":"d60386740aeb4dbfe42e7fa02876523ee5f34451"},{"author":{"_account_id":8749,"name":"Evgeniy L","email":"eli@mirantis.com","username":"evgeniyl"},"change_message_id":"a3f6c05eae8a992e72df6557110079a4350d2b48","unresolved":false,"context_lines":[{"line_number":410,"context_line":"        try:"},{"line_number":411,"context_line":"            status, node \u003d self.update_node_state(node_data, True)"},{"line_number":412,"context_line":"        except Exception:"},{"line_number":413,"context_line":"            status, node \u003d self.register_node(node_data)"},{"line_number":414,"context_line":""},{"line_number":415,"context_line":"        node.timestamp \u003d datetime.now()"},{"line_number":416,"context_line":"        if not node.online:"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAUH%2F9gOY%3D","line":413,"in_reply_to":"AAAAUH%2F9oWw%3D","updated":"2014-02-07 09:09:15.000000000","message":"This comment is not about moving business logic to some other objects.\n\nHere you try to catch all exceptions and then register node, during update we can have other exceptions, because agent can send us some invalid data which validator didn\u0027t catch, in this case node already registered, but we try to register it again.","commit_id":"d60386740aeb4dbfe42e7fa02876523ee5f34451"},{"author":{"_account_id":8749,"name":"Evgeniy L","email":"eli@mirantis.com","username":"evgeniyl"},"change_message_id":"0969bf65183d1d8bcb634169bdcbb4ac017e6bf9","unresolved":false,"context_lines":[{"line_number":412,"context_line":"        except Exception:"},{"line_number":413,"context_line":"            status, node \u003d self.register_node(node_data)"},{"line_number":414,"context_line":""},{"line_number":415,"context_line":"        node.timestamp \u003d datetime.now()"},{"line_number":416,"context_line":"        if not node.online:"},{"line_number":417,"context_line":"            node.online \u003d True"},{"line_number":418,"context_line":"            msg \u003d u\"Node \u0027{0}\u0027 is back online\".format("}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAUH%2F9o3Q%3D","line":415,"updated":"2014-02-05 13:09:52.000000000","message":"As soon as we retrieved node from db, we need to update and commit this field `timestamp`. We have messy update logic above and if there will be some exception we don\u0027t want to move this node to offline, because in fact it\u0027s online and we received request from agent.","commit_id":"d60386740aeb4dbfe42e7fa02876523ee5f34451"},{"author":{"_account_id":10212,"name":"Dmitry Sokolov","email":"dsokolov@mirantis.com","username":"demon.mhm"},"change_message_id":"d1afe8b7cb072479f00b19d807b88b6dbacc51f9","unresolved":false,"context_lines":[{"line_number":412,"context_line":"        except Exception:"},{"line_number":413,"context_line":"            status, node \u003d self.register_node(node_data)"},{"line_number":414,"context_line":""},{"line_number":415,"context_line":"        node.timestamp \u003d datetime.now()"},{"line_number":416,"context_line":"        if not node.online:"},{"line_number":417,"context_line":"            node.online \u003d True"},{"line_number":418,"context_line":"            msg \u003d u\"Node \u0027{0}\u0027 is back online\".format("}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAUH%2F9oY8%3D","line":415,"in_reply_to":"AAAAUH%2F9o3Q%3D","updated":"2014-02-05 14:38:10.000000000","message":"It\u0027s commited right after setting/checking node status to \u0027online\u0027. Its strange to update offline node timestamp.","commit_id":"d60386740aeb4dbfe42e7fa02876523ee5f34451"},{"author":{"_account_id":8749,"name":"Evgeniy L","email":"eli@mirantis.com","username":"evgeniyl"},"change_message_id":"a3f6c05eae8a992e72df6557110079a4350d2b48","unresolved":false,"context_lines":[{"line_number":412,"context_line":"        except Exception:"},{"line_number":413,"context_line":"            status, node \u003d self.register_node(node_data)"},{"line_number":414,"context_line":""},{"line_number":415,"context_line":"        node.timestamp \u003d datetime.now()"},{"line_number":416,"context_line":"        if not node.online:"},{"line_number":417,"context_line":"            node.online \u003d True"},{"line_number":418,"context_line":"            msg \u003d u\"Node \u0027{0}\u0027 is back online\".format("}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAUH%2F9gM0%3D","line":415,"in_reply_to":"AAAAUH%2F9oY8%3D","updated":"2014-02-07 09:09:15.000000000","message":"Lets consider the next case, which happens sometimes in real deployment (for example we had problems when during deployment node can lose interfaces as result agent sends invalid data)\n\n1. nodes sent half-invalid data\n\n2. we started to update data\n\n3. during the upgrade we have an error (exception was raised)\n\n4. timestamp wasn\u0027t updated\n\n5. node went offline (but in fact it was online)","commit_id":"d60386740aeb4dbfe42e7fa02876523ee5f34451"},{"author":{"_account_id":8749,"name":"Evgeniy L","email":"eli@mirantis.com","username":"evgeniyl"},"change_message_id":"0969bf65183d1d8bcb634169bdcbb4ac017e6bf9","unresolved":false,"context_lines":[{"line_number":427,"context_line":""},{"line_number":428,"context_line":"        if status \u003d\u003d web.webapi.notmodified:"},{"line_number":429,"context_line":"            raise status()"},{"line_number":430,"context_line":"        else:"},{"line_number":431,"context_line":"            raise status("},{"line_number":432,"context_line":"                json.dumps({\u0027id\u0027: node.id}),"},{"line_number":433,"context_line":"                headers\u003d{\u0027Content-type\u0027: \u0027application/json\u0027}"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAUH%2F9pQQ%3D","line":430,"updated":"2014-02-05 13:09:52.000000000","message":"We can remove this else.","commit_id":"d60386740aeb4dbfe42e7fa02876523ee5f34451"},{"author":{"_account_id":8749,"name":"Evgeniy L","email":"eli@mirantis.com","username":"evgeniyl"},"change_message_id":"a3f6c05eae8a992e72df6557110079a4350d2b48","unresolved":false,"context_lines":[{"line_number":427,"context_line":""},{"line_number":428,"context_line":"        if status \u003d\u003d web.webapi.notmodified:"},{"line_number":429,"context_line":"            raise status()"},{"line_number":430,"context_line":"        else:"},{"line_number":431,"context_line":"            raise status("},{"line_number":432,"context_line":"                json.dumps({\u0027id\u0027: node.id}),"},{"line_number":433,"context_line":"                headers\u003d{\u0027Content-type\u0027: \u0027application/json\u0027}"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAUH%2F9gUM%3D","line":430,"in_reply_to":"AAAAUH%2F9oaA%3D","updated":"2014-02-07 09:09:15.000000000","message":"It\u0027s similar to the next code\n\n    if condition:\n        return 1\n\n    return 2","commit_id":"d60386740aeb4dbfe42e7fa02876523ee5f34451"},{"author":{"_account_id":10212,"name":"Dmitry Sokolov","email":"dsokolov@mirantis.com","username":"demon.mhm"},"change_message_id":"d1afe8b7cb072479f00b19d807b88b6dbacc51f9","unresolved":false,"context_lines":[{"line_number":427,"context_line":""},{"line_number":428,"context_line":"        if status \u003d\u003d web.webapi.notmodified:"},{"line_number":429,"context_line":"            raise status()"},{"line_number":430,"context_line":"        else:"},{"line_number":431,"context_line":"            raise status("},{"line_number":432,"context_line":"                json.dumps({\u0027id\u0027: node.id}),"},{"line_number":433,"context_line":"                headers\u003d{\u0027Content-type\u0027: \u0027application/json\u0027}"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAUH%2F9oaA%3D","line":430,"in_reply_to":"AAAAUH%2F9pQQ%3D","updated":"2014-02-05 14:38:10.000000000","message":"No we cant because of different arguments for raising.","commit_id":"d60386740aeb4dbfe42e7fa02876523ee5f34451"},{"author":{"_account_id":8930,"name":"Alexandr Notchenko","email":"anotchenko@mirantis.com","username":"anotchenko"},"change_message_id":"ecbe47421133f6e67983592011eeb811f0184590","unresolved":false,"context_lines":[{"line_number":240,"context_line":"                u\"Failed to generate volumes \""},{"line_number":241,"context_line":"                \"info for node \u0027{0}\u0027: \u0027{1}\u0027\""},{"line_number":242,"context_line":"            ).format("},{"line_number":243,"context_line":"                node.name or node_data.get(\"mac\") or node_data.get(\"id\"),"},{"line_number":244,"context_line":"                str(exc) or \"see logs for details\""},{"line_number":245,"context_line":"            )"},{"line_number":246,"context_line":"            logger.warning(traceback.format_exc())"}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAUX%2F%2BvFM%3D","line":243,"updated":"2014-02-19 13:19:12.000000000","message":"node has special property human_readable_name, we should use it in cases like this.","commit_id":"08c5385e4177158fcd5b45dcca394d46b0f96b20"},{"author":{"_account_id":10212,"name":"Dmitry Sokolov","email":"dsokolov@mirantis.com","username":"demon.mhm"},"change_message_id":"9d19b597f8b67fcd8ebf0387bed019a01a7c5e6a","unresolved":false,"context_lines":[{"line_number":240,"context_line":"                u\"Failed to generate volumes \""},{"line_number":241,"context_line":"                \"info for node \u0027{0}\u0027: \u0027{1}\u0027\""},{"line_number":242,"context_line":"            ).format("},{"line_number":243,"context_line":"                node.name or node_data.get(\"mac\") or node_data.get(\"id\"),"},{"line_number":244,"context_line":"                str(exc) or \"see logs for details\""},{"line_number":245,"context_line":"            )"},{"line_number":246,"context_line":"            logger.warning(traceback.format_exc())"}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAUX%2F%2BvBA%3D","line":243,"in_reply_to":"AAAAUX%2F%2BvFM%3D","updated":"2014-02-19 13:30:56.000000000","message":"Done","commit_id":"08c5385e4177158fcd5b45dcca394d46b0f96b20"},{"author":{"_account_id":8749,"name":"Evgeniy L","email":"eli@mirantis.com","username":"evgeniyl"},"change_message_id":"2fb820d4270293b6ded3440e6f85854bd96deda1","unresolved":false,"context_lines":[{"line_number":404,"context_line":""},{"line_number":405,"context_line":"        node_data \u003d self.checked_data("},{"line_number":406,"context_line":"            self.validator.validate_collection_update"},{"line_number":407,"context_line":"        )[0]"},{"line_number":408,"context_line":""},{"line_number":409,"context_line":"        # caching by simply hashing raw put data from node"},{"line_number":410,"context_line":"        node_data[\u0027meta_checksum\u0027] \u003d hashlib.sha1(web.data()).hexdigest()"}],"source_content_type":"text/x-python","patch_set":16,"id":"AAAAUX%2F%2BuYw%3D","line":407,"updated":"2014-02-19 15:18:03.000000000","message":"When node tries to register in nailgun, it just fails\n\n    Response: status: 400 body: Invalid MAC specified","commit_id":"1d189ff97d7de3f28f8e7da3acf734873c80b141"},{"author":{"_account_id":8053,"name":"Nikolay Markov","email":"nmarkov@mirantis.com","username":"NikolayMarkov"},"change_message_id":"a0a64dff6fd748b429036660c9aa1b5d800c47ab","unresolved":false,"context_lines":[{"line_number":413,"context_line":"            status, node \u003d self.update_node_state(node, node_data, True)"},{"line_number":414,"context_line":"        except errors.InvalidData:"},{"line_number":415,"context_line":"            node_data \u003d self.validator.validate_json(web.data())[0]"},{"line_number":416,"context_line":"            status, node \u003d self.register_node(node_data)"},{"line_number":417,"context_line":""},{"line_number":418,"context_line":"        node.timestamp \u003d datetime.now()"},{"line_number":419,"context_line":"        if not node.online:"}],"source_content_type":"text/x-python","patch_set":17,"id":"AAAAUX%2F%2Blbo%3D","line":416,"updated":"2014-02-20 11:08:00.000000000","message":"Looks naive. Are you sure that the only exception here is InvalidData and that this code under \"except\" won\u0027t raise any?","commit_id":"a5088254a8e55037ffaff241ec35e6e1967b1d57"},{"author":{"_account_id":406,"name":"Mike Scherbakov","email":"mihgen@gmail.com","username":"mihgen"},"change_message_id":"c1e9d4ece2e8813b25d369244d1033bb9db09db0","unresolved":false,"context_lines":[{"line_number":297,"context_line":""},{"line_number":298,"context_line":"        # do not update db if nothings changed"},{"line_number":299,"context_line":"        if \u0027meta_checksum\u0027 in nd and nd[\u0027meta_checksum\u0027] \u003d\u003d node.meta_checksum:"},{"line_number":300,"context_line":"            return web.webapi.notmodified, node"},{"line_number":301,"context_line":""},{"line_number":302,"context_line":"        old_cluster_id \u003d node.cluster_id"},{"line_number":303,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUX%2F%2BfXI%3D","line":300,"updated":"2014-02-20 23:34:43.000000000","message":"this could be matter of style.... but I usually prefer helper functions not to touch stuff they don\u0027t need. In this example, you return web object, and you could simply true/false or some other simple object, which you would later parse and form required http response.","commit_id":"c56875779ffc3c310c6f861c3832ee8d57b4282f"},{"author":{"_account_id":406,"name":"Mike Scherbakov","email":"mihgen@gmail.com","username":"mihgen"},"change_message_id":"c1e9d4ece2e8813b25d369244d1033bb9db09db0","unresolved":false,"context_lines":[{"line_number":391,"context_line":"            (self.get_node_by_data(nd), nd) for nd in nodes_data"},{"line_number":392,"context_line":"        ]"},{"line_number":393,"context_line":"        return ["},{"line_number":394,"context_line":"            self.update_node_state(n, d)[1] for n, d in nodes_to_update if n"},{"line_number":395,"context_line":"        ]"},{"line_number":396,"context_line":""},{"line_number":397,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUX%2F%2BfTE%3D","line":394,"updated":"2014-02-20 23:34:43.000000000","message":"Looks like that if update of 1st node fails for any reason, then all other nodes will not be updated. This is kind of behavior we must avoid: 1 node must node affect the whole environment. User should be notified about errors on one node, it might be marked as Error / notification is raised about it. The idea is that user will be able to simply remove failing node from the env, and continue to operate with the rest.\nI didn\u0027t test this scenario, and only guessing from the code. Please write test and research what really happens and what would be the best implementation for the issue I described, if it exists.","commit_id":"c56875779ffc3c310c6f861c3832ee8d57b4282f"},{"author":{"_account_id":406,"name":"Mike Scherbakov","email":"mihgen@gmail.com","username":"mihgen"},"change_message_id":"c1e9d4ece2e8813b25d369244d1033bb9db09db0","unresolved":false,"context_lines":[{"line_number":416,"context_line":"                    web.data()"},{"line_number":417,"context_line":"                )[0]"},{"line_number":418,"context_line":"                # caching by simply hashing raw put data from node"},{"line_number":419,"context_line":"                node_data[\u0027meta_checksum\u0027] \u003d hashlib.sha1("},{"line_number":420,"context_line":"                    web.data()"},{"line_number":421,"context_line":"                ).hexdigest()"},{"line_number":422,"context_line":"                status, node \u003d self.update_node_state(node, node_data, True)"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUX%2F%2BfdI%3D","line":419,"updated":"2014-02-20 23:34:43.000000000","message":"Why don\u0027t we reload this CPU-consuming thing on agent side? Agent could calculate it and pass as an additional param, and it would be just a matter of taking it from web.data, without calculation.","commit_id":"c56875779ffc3c310c6f861c3832ee8d57b4282f"},{"author":{"_account_id":8797,"name":"Andrew Woodward","email":"xarses@gmail.com","username":"xarses"},"change_message_id":"e85b8a99ff4b2ce1b09f272f3730b7f7eb88fadf","unresolved":false,"context_lines":[{"line_number":416,"context_line":"                    web.data()"},{"line_number":417,"context_line":"                )[0]"},{"line_number":418,"context_line":"                # caching by simply hashing raw put data from node"},{"line_number":419,"context_line":"                node_data[\u0027meta_checksum\u0027] \u003d hashlib.sha1("},{"line_number":420,"context_line":"                    web.data()"},{"line_number":421,"context_line":"                ).hexdigest()"},{"line_number":422,"context_line":"                status, node \u003d self.update_node_state(node, node_data, True)"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUX%2F%2BVyA%3D","line":419,"in_reply_to":"AAAAUX%2F%2BfdI%3D","updated":"2014-02-21 20:07:27.000000000","message":"Seconded, the agent should be tracking the data it sent and DIFF it. Because ruby 1.8.9 doesn\u0027t enforce order, the results will be in random order, so a SHA isn\u0027t going to work anyway. Not to mention that it\u0027s intensive enough to completely offset what we where doing before.\n\nI think the api handler should allow for partial data updates if the node/agent knows a discrete item changed, if it somehow looses track, it should resend all of the data. This would help with load by removing some of the processing needed to update all of the data structures.","commit_id":"c56875779ffc3c310c6f861c3832ee8d57b4282f"},{"author":{"_account_id":406,"name":"Mike Scherbakov","email":"mihgen@gmail.com","username":"mihgen"},"change_message_id":"c1e9d4ece2e8813b25d369244d1033bb9db09db0","unresolved":false,"context_lines":[{"line_number":421,"context_line":"                ).hexdigest()"},{"line_number":422,"context_line":"                status, node \u003d self.update_node_state(node, node_data, True)"},{"line_number":423,"context_line":"            except errors.InvalidData as e:"},{"line_number":424,"context_line":"                raise web.badrequest(e.message)"},{"line_number":425,"context_line":"        else:"},{"line_number":426,"context_line":"            try:"},{"line_number":427,"context_line":"                status, node \u003d self.register_node(node_data)"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUX%2F%2BfW4%3D","line":424,"updated":"2014-02-20 23:34:43.000000000","message":"Don\u0027t we miss traceback here? Will it be saved in app.log, what exactly happened?","commit_id":"c56875779ffc3c310c6f861c3832ee8d57b4282f"},{"author":{"_account_id":406,"name":"Mike Scherbakov","email":"mihgen@gmail.com","username":"mihgen"},"change_message_id":"c1e9d4ece2e8813b25d369244d1033bb9db09db0","unresolved":false,"context_lines":[{"line_number":438,"context_line":"            notifier.notify(\"discover\", msg, node_id\u003dnode.id)"},{"line_number":439,"context_line":"        db().commit()"},{"line_number":440,"context_line":"        network_manager \u003d NetworkManager"},{"line_number":441,"context_line":"        network_manager.update_interfaces_info(node)"},{"line_number":442,"context_line":"        db().commit()"},{"line_number":443,"context_line":""},{"line_number":444,"context_line":"        if status \u003d\u003d web.webapi.notmodified:"}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUX%2F%2BfZo%3D","line":441,"updated":"2014-02-20 23:34:43.000000000","message":"Why are we always updating network interfaces? If there were no modifications in data, doesn\u0027t it mean that interfaces are still the same?","commit_id":"c56875779ffc3c310c6f861c3832ee8d57b4282f"}],"nailgun/nailgun/db/sqlalchemy/models/node.py":[{"author":{"_account_id":8749,"name":"Evgeniy L","email":"eli@mirantis.com","username":"evgeniyl"},"change_message_id":"0969bf65183d1d8bcb634169bdcbb4ac017e6bf9","unresolved":false,"context_lines":[{"line_number":119,"context_line":"                              cascade\u003d\"delete\","},{"line_number":120,"context_line":"                              order_by\u003d\"NodeNICInterface.name\")"},{"line_number":121,"context_line":"    # sha1 hexdigest of incoming node info to avoid useless updates from agent"},{"line_number":122,"context_line":"    cached \u003d Column(String(40), default\u003d\u0027\u0027)"},{"line_number":123,"context_line":""},{"line_number":124,"context_line":"    @property"},{"line_number":125,"context_line":"    def uid(self):"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAUH%2F9o2g%3D","line":122,"updated":"2014-02-05 13:09:52.000000000","message":"Lets give more verbose for this variable, e.g. meta_hashsum , or last_meta_hashsum","commit_id":"d60386740aeb4dbfe42e7fa02876523ee5f34451"},{"author":{"_account_id":10212,"name":"Dmitry Sokolov","email":"dsokolov@mirantis.com","username":"demon.mhm"},"change_message_id":"4968821589253f6c02d2b78ebde314538319ff87","unresolved":false,"context_lines":[{"line_number":119,"context_line":"                              cascade\u003d\"delete\","},{"line_number":120,"context_line":"                              order_by\u003d\"NodeNICInterface.name\")"},{"line_number":121,"context_line":"    # sha1 hexdigest of incoming node info to avoid useless updates from agent"},{"line_number":122,"context_line":"    cached \u003d Column(String(40), default\u003d\u0027\u0027)"},{"line_number":123,"context_line":""},{"line_number":124,"context_line":"    @property"},{"line_number":125,"context_line":"    def uid(self):"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAUH%2F9h4s%3D","line":122,"in_reply_to":"AAAAUH%2F9o2g%3D","updated":"2014-02-06 09:26:35.000000000","message":"Done","commit_id":"d60386740aeb4dbfe42e7fa02876523ee5f34451"},{"author":{"_account_id":8749,"name":"Evgeniy L","email":"eli@mirantis.com","username":"evgeniyl"},"change_message_id":"61e79900d2335857d54ff9e69890837cc21db01c","unresolved":false,"context_lines":[{"line_number":127,"context_line":"    @property"},{"line_number":128,"context_line":"    def interfaces(self):"},{"line_number":129,"context_line":"        return self.nic_interfaces + self.bond_interfaces"},{"line_number":130,"context_line":"    # sha1 hexdigest of incoming node info to avoid useless updates from agent"},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"    @property"},{"line_number":133,"context_line":"    def uid(self):"}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAUX%2F%2BvYg%3D","line":130,"updated":"2014-02-19 12:49:21.000000000","message":"Hm I think this comment should be right above \u0027meta_checksum\u0027 parameter.","commit_id":"08c5385e4177158fcd5b45dcca394d46b0f96b20"},{"author":{"_account_id":10212,"name":"Dmitry Sokolov","email":"dsokolov@mirantis.com","username":"demon.mhm"},"change_message_id":"9d19b597f8b67fcd8ebf0387bed019a01a7c5e6a","unresolved":false,"context_lines":[{"line_number":127,"context_line":"    @property"},{"line_number":128,"context_line":"    def interfaces(self):"},{"line_number":129,"context_line":"        return self.nic_interfaces + self.bond_interfaces"},{"line_number":130,"context_line":"    # sha1 hexdigest of incoming node info to avoid useless updates from agent"},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"    @property"},{"line_number":133,"context_line":"    def uid(self):"}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAUX%2F%2Bu%2B4%3D","line":130,"in_reply_to":"AAAAUX%2F%2BvYg%3D","updated":"2014-02-19 13:30:56.000000000","message":"Done","commit_id":"08c5385e4177158fcd5b45dcca394d46b0f96b20"}],"nailgun/nailgun/test/unit/test_node_nic_handler.py":[{"author":{"_account_id":406,"name":"Mike Scherbakov","email":"mihgen@gmail.com","username":"mihgen"},"change_message_id":"c1e9d4ece2e8813b25d369244d1033bb9db09db0","unresolved":false,"context_lines":[{"line_number":274,"context_line":"            headers\u003dself.default_headers,"},{"line_number":275,"context_line":"            expect_errors\u003dTrue,"},{"line_number":276,"context_line":"        )"},{"line_number":277,"context_line":"        self.assertEquals(resp.status, 304)"},{"line_number":278,"context_line":""},{"line_number":279,"context_line":"        meta[\u0027interfaces\u0027].append({\u0027name\u0027: \u0027new_nic\u0027, \u0027mac\u0027: \u0027643\u0027})"},{"line_number":280,"context_line":"        resp \u003d self.app.put("}],"source_content_type":"text/x-python","patch_set":18,"id":"AAAAUX%2F%2BfQc%3D","line":277,"updated":"2014-02-20 23:34:43.000000000","message":"the 2 parts of the test above should go to collection handler tests. combination of 1st part and 3rd should stay here. Basically by 1 unit test we want to test 1 thing, and you test 2 things in a single test.","commit_id":"c56875779ffc3c310c6f861c3832ee8d57b4282f"}]}
