)]}'
{"cyborg/api/controllers/v2/device_profiles.py":[{"author":{"_account_id":14131,"name":"shaohef","email":"shaohe.feng@intel.com","username":"shaohefeng"},"change_message_id":"0716af31a2d4ab4d14e4caaf9ef49565e304dc37","unresolved":false,"context_lines":[{"line_number":104,"context_line":"         }"},{"line_number":105,"context_line":"        \"\"\""},{"line_number":106,"context_line":"        # TODO Support more than one devprof per request"},{"line_number":107,"context_line":"        # TODO validate that device profile names look like (\\w)+"},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"        context \u003d pecan.request.context"},{"line_number":110,"context_line":"        obj_devprof \u003d objects.DeviceProfile(context, **req_devprof)"}],"source_content_type":"text/x-python","patch_set":6,"id":"7faddb67_4e98f9be","line":107,"range":{"start_line":107,"start_character":15,"end_line":107,"end_character":65},"updated":"2019-08-01 16:35:31.000000000","message":"also validate every fields of req_devprof boy.","commit_id":"819b99e0d53a188d17c382236dbc7ef72058c2fd"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"f00769e726568ecdb9b9f7ab463b032835e66ac4","unresolved":false,"context_lines":[{"line_number":104,"context_line":"         }"},{"line_number":105,"context_line":"        \"\"\""},{"line_number":106,"context_line":"        # TODO Support more than one devprof per request"},{"line_number":107,"context_line":"        # TODO validate that device profile names look like (\\w)+"},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"        context \u003d pecan.request.context"},{"line_number":110,"context_line":"        obj_devprof \u003d objects.DeviceProfile(context, **req_devprof)"}],"source_content_type":"text/x-python","patch_set":6,"id":"7faddb67_326d37cc","line":107,"range":{"start_line":107,"start_character":15,"end_line":107,"end_character":65},"in_reply_to":"7faddb67_4e98f9be","updated":"2019-08-28 06:24:13.000000000","message":"Done","commit_id":"819b99e0d53a188d17c382236dbc7ef72058c2fd"},{"author":{"_account_id":25738,"name":"Xinran WANG","email":"xin-ran.wang@intel.com","username":"Xinran"},"change_message_id":"e4de034e16a4ad63592ad1f613aae1a5509cb389","unresolved":false,"context_lines":[{"line_number":112,"context_line":"        # TODO Only the conductor must write to the db"},{"line_number":113,"context_line":"        obj_devprof.create(context)"},{"line_number":114,"context_line":"        ret \u003d DeviceProfile.get_api_obj(obj_devprof)"},{"line_number":115,"context_line":"        return wsme.api.Response(ret, status_code\u003dhttp_client.CREATED,"},{"line_number":116,"context_line":"                                 return_type\u003dwsme.types.DictType)"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"    def _get_device_profile_list(self, names):"}],"source_content_type":"text/x-python","patch_set":6,"id":"7faddb67_010bcb7c","line":115,"range":{"start_line":115,"start_character":14,"end_line":115,"end_character":37},"updated":"2019-07-31 14:20:39.000000000","message":"please try to get rid of this, instead we can use https://github.com/openstack/cyborg/blob/master/cyborg/api/controllers/v1/deployables.py#L72. It\u0027s better to avoid using wsme.api expression all the time.","commit_id":"819b99e0d53a188d17c382236dbc7ef72058c2fd"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"f00769e726568ecdb9b9f7ab463b032835e66ac4","unresolved":false,"context_lines":[{"line_number":112,"context_line":"        # TODO Only the conductor must write to the db"},{"line_number":113,"context_line":"        obj_devprof.create(context)"},{"line_number":114,"context_line":"        ret \u003d DeviceProfile.get_api_obj(obj_devprof)"},{"line_number":115,"context_line":"        return wsme.api.Response(ret, status_code\u003dhttp_client.CREATED,"},{"line_number":116,"context_line":"                                 return_type\u003dwsme.types.DictType)"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"    def _get_device_profile_list(self, names):"}],"source_content_type":"text/x-python","patch_set":6,"id":"7faddb67_47ce255c","line":115,"range":{"start_line":115,"start_character":14,"end_line":115,"end_character":37},"in_reply_to":"7faddb67_010bcb7c","updated":"2019-08-28 06:24:13.000000000","message":"Added as TODO","commit_id":"819b99e0d53a188d17c382236dbc7ef72058c2fd"},{"author":{"_account_id":14131,"name":"shaohef","email":"shaohe.feng@intel.com","username":"shaohefeng"},"change_message_id":"0716af31a2d4ab4d14e4caaf9ef49565e304dc37","unresolved":false,"context_lines":[{"line_number":119,"context_line":"        \"\"\"Get a list of API objects representing device profiles.\"\"\""},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"        context \u003d pecan.request.context"},{"line_number":122,"context_line":"        obj_devprofs \u003d objects.DeviceProfile.list(context)"},{"line_number":123,"context_line":"        if names !\u003d []:"},{"line_number":124,"context_line":"            new_obj_devprofs \u003d [devprof for devprof in obj_devprofs"},{"line_number":125,"context_line":"                                if devprof[\u0027name\u0027] in names]"},{"line_number":126,"context_line":"            obj_devprofs \u003d new_obj_devprofs"},{"line_number":127,"context_line":""},{"line_number":128,"context_line":"        api_obj_devprofs \u003d DeviceProfileCollection.get_api_objs(obj_devprofs)"},{"line_number":129,"context_line":""},{"line_number":130,"context_line":"        return api_obj_devprofs"},{"line_number":131,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"7faddb67_8e56f1cd","line":128,"range":{"start_line":122,"start_character":8,"end_line":128,"end_character":77},"updated":"2019-08-01 16:35:31.000000000","message":"IMHO, the DB under layer can support list by name filters.","commit_id":"819b99e0d53a188d17c382236dbc7ef72058c2fd"},{"author":{"_account_id":25738,"name":"Xinran WANG","email":"xin-ran.wang@intel.com","username":"Xinran"},"change_message_id":"e4de034e16a4ad63592ad1f613aae1a5509cb389","unresolved":false,"context_lines":[{"line_number":133,"context_line":"    @expose.expose(\u0027json\u0027, wtypes.text)"},{"line_number":134,"context_line":"    def get_all(self, name\u003dNone):"},{"line_number":135,"context_line":"        \"\"\"Retrieve a list of device profiles.\"\"\""},{"line_number":136,"context_line":"        names \u003d pecan.request.GET.get(\u0027name\u0027)"},{"line_number":137,"context_line":"        if names is not None:"},{"line_number":138,"context_line":"            names \u003d names.split(\u0027,\u0027)"},{"line_number":139,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":6,"id":"7faddb67_c156135d","line":136,"range":{"start_line":136,"start_character":8,"end_line":136,"end_character":45},"updated":"2019-07-31 14:20:39.000000000","message":"I am confused about this assignment, where can we get the names.","commit_id":"819b99e0d53a188d17c382236dbc7ef72058c2fd"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"f00769e726568ecdb9b9f7ab463b032835e66ac4","unresolved":false,"context_lines":[{"line_number":133,"context_line":"    @expose.expose(\u0027json\u0027, wtypes.text)"},{"line_number":134,"context_line":"    def get_all(self, name\u003dNone):"},{"line_number":135,"context_line":"        \"\"\"Retrieve a list of device profiles.\"\"\""},{"line_number":136,"context_line":"        names \u003d pecan.request.GET.get(\u0027name\u0027)"},{"line_number":137,"context_line":"        if names is not None:"},{"line_number":138,"context_line":"            names \u003d names.split(\u0027,\u0027)"},{"line_number":139,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":6,"id":"7faddb67_27d529e6","line":136,"range":{"start_line":136,"start_character":8,"end_line":136,"end_character":45},"in_reply_to":"7faddb67_c156135d","updated":"2019-08-28 06:24:13.000000000","message":"This line gets it from pecan\u0027s request object. But that is not necessary: we can get it as a method parameter in Line 134. So, I removed this line.","commit_id":"819b99e0d53a188d17c382236dbc7ef72058c2fd"},{"author":{"_account_id":25738,"name":"Xinran WANG","email":"xin-ran.wang@intel.com","username":"Xinran"},"change_message_id":"e4de034e16a4ad63592ad1f613aae1a5509cb389","unresolved":false,"context_lines":[{"line_number":143,"context_line":""},{"line_number":144,"context_line":"        ret \u003d {\"device_profiles\": api_obj_devprofs}"},{"line_number":145,"context_line":"        LOG.info(\u0027[device_profiles] get_all returned: %s\u0027, ret)"},{"line_number":146,"context_line":"        return wsme.api.Response(ret, status_code\u003dhttp_client.OK,"},{"line_number":147,"context_line":"                                 return_type\u003dwsme.types.DictType)"},{"line_number":148,"context_line":""},{"line_number":149,"context_line":"    # @policy.authorize_wsgi(\"cyborg:device_profile\", \"get_one\")"}],"source_content_type":"text/x-python","patch_set":6,"id":"7faddb67_c12853e3","line":146,"range":{"start_line":146,"start_character":15,"end_line":146,"end_character":23},"updated":"2019-07-31 14:20:39.000000000","message":"ditto","commit_id":"819b99e0d53a188d17c382236dbc7ef72058c2fd"},{"author":{"_account_id":25738,"name":"Xinran WANG","email":"xin-ran.wang@intel.com","username":"Xinran"},"change_message_id":"e4de034e16a4ad63592ad1f613aae1a5509cb389","unresolved":false,"context_lines":[{"line_number":150,"context_line":"    @expose.expose(\u0027json\u0027, wtypes.text)"},{"line_number":151,"context_line":"    def get_one(self, name):"},{"line_number":152,"context_line":"        \"\"\"Retrieve a single device profile by name.\"\"\""},{"line_number":153,"context_line":"        names \u003d [name]"},{"line_number":154,"context_line":"        api_obj_devprofs \u003d self._get_device_profile_list(names)"},{"line_number":155,"context_line":"        if len(api_obj_devprofs) \u003d\u003d 0:"},{"line_number":156,"context_line":"            raise exception.DeviceProfileNameNotFound(name\u003dname)"}],"source_content_type":"text/x-python","patch_set":6,"id":"7faddb67_e101cf39","line":153,"range":{"start_line":153,"start_character":8,"end_line":153,"end_character":22},"updated":"2019-07-31 14:20:39.000000000","message":"We can pass one name to the function in L118 and rename it to _get_device_profile(name), and we can do a loop in L142. IMO, it\u0027s a more regular way in logic.","commit_id":"819b99e0d53a188d17c382236dbc7ef72058c2fd"},{"author":{"_account_id":14131,"name":"shaohef","email":"shaohe.feng@intel.com","username":"shaohefeng"},"change_message_id":"0716af31a2d4ab4d14e4caaf9ef49565e304dc37","unresolved":false,"context_lines":[{"line_number":150,"context_line":"    @expose.expose(\u0027json\u0027, wtypes.text)"},{"line_number":151,"context_line":"    def get_one(self, name):"},{"line_number":152,"context_line":"        \"\"\"Retrieve a single device profile by name.\"\"\""},{"line_number":153,"context_line":"        names \u003d [name]"},{"line_number":154,"context_line":"        api_obj_devprofs \u003d self._get_device_profile_list(names)"},{"line_number":155,"context_line":"        if len(api_obj_devprofs) \u003d\u003d 0:"},{"line_number":156,"context_line":"            raise exception.DeviceProfileNameNotFound(name\u003dname)"}],"source_content_type":"text/x-python","patch_set":6,"id":"7faddb67_ee33e5a9","line":153,"range":{"start_line":153,"start_character":8,"end_line":153,"end_character":22},"in_reply_to":"7faddb67_e101cf39","updated":"2019-08-01 16:35:31.000000000","message":"yes, the logic is twist for one profile request.","commit_id":"819b99e0d53a188d17c382236dbc7ef72058c2fd"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"f00769e726568ecdb9b9f7ab463b032835e66ac4","unresolved":false,"context_lines":[{"line_number":150,"context_line":"    @expose.expose(\u0027json\u0027, wtypes.text)"},{"line_number":151,"context_line":"    def get_one(self, name):"},{"line_number":152,"context_line":"        \"\"\"Retrieve a single device profile by name.\"\"\""},{"line_number":153,"context_line":"        names \u003d [name]"},{"line_number":154,"context_line":"        api_obj_devprofs \u003d self._get_device_profile_list(names)"},{"line_number":155,"context_line":"        if len(api_obj_devprofs) \u003d\u003d 0:"},{"line_number":156,"context_line":"            raise exception.DeviceProfileNameNotFound(name\u003dname)"}],"source_content_type":"text/x-python","patch_set":6,"id":"7faddb67_67f48188","line":153,"range":{"start_line":153,"start_character":8,"end_line":153,"end_character":22},"in_reply_to":"7faddb67_ee33e5a9","updated":"2019-08-28 06:24:13.000000000","message":"The logic is optimized for reading multiple device profiles from the db in one shot. Even if we push name filtering to the db layer, it is not ideal to repeatedly read from the db if we have a list.\n\nThis is all a bit beside the point because the main client now is Nova, and it queries a single device profile by name.","commit_id":"819b99e0d53a188d17c382236dbc7ef72058c2fd"},{"author":{"_account_id":25738,"name":"Xinran WANG","email":"xin-ran.wang@intel.com","username":"Xinran"},"change_message_id":"e4de034e16a4ad63592ad1f613aae1a5509cb389","unresolved":false,"context_lines":[{"line_number":160,"context_line":"            raise exception.ExpectedOneObject(obj\u003d\u0027device profile\u0027,"},{"line_number":161,"context_line":"                                              count\u003dcount)"},{"line_number":162,"context_line":"        ret \u003d {\"device_profiles\": api_obj_devprofs[0]}"},{"line_number":163,"context_line":"        return wsme.api.Response(ret, status_code\u003dhttp_client.OK,"},{"line_number":164,"context_line":"                                 return_type\u003dwsme.types.DictType)"},{"line_number":165,"context_line":""},{"line_number":166,"context_line":"    # @policy.authorize_wsgi(\"cyborg:device_profile\", \"delete\")"}],"source_content_type":"text/x-python","patch_set":6,"id":"7faddb67_0180abbe","line":163,"range":{"start_line":163,"start_character":15,"end_line":163,"end_character":23},"updated":"2019-07-31 14:20:39.000000000","message":"ditto","commit_id":"819b99e0d53a188d17c382236dbc7ef72058c2fd"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"ad8dc57c0577641177c7ca4d7d1930ff7b004cb1","unresolved":false,"context_lines":[{"line_number":116,"context_line":"        return wsme.api.Response(ret, status_code\u003dhttp_client.CREATED,"},{"line_number":117,"context_line":"                                 return_type\u003dwsme.types.DictType)"},{"line_number":118,"context_line":""},{"line_number":119,"context_line":"    def _get_device_profile_list(self, names\u003d[], uuid\u003dNone):"},{"line_number":120,"context_line":"        \"\"\"Get a list of API objects representing device profiles.\"\"\""},{"line_number":121,"context_line":""},{"line_number":122,"context_line":"        context \u003d pecan.request.context"}],"source_content_type":"text/x-python","patch_set":15,"id":"7faddb67_1d92a759","line":119,"range":{"start_line":119,"start_character":39,"end_line":119,"end_character":47},"updated":"2019-08-27 06:37:45.000000000","message":"Hi, Sundar Nadathur. list and dict are variable in Python. I recommand to init \u0027names\u003dNone\u0027","commit_id":"0e6964d5b8457a278746775cebd2e9e5e47e217f"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"f00769e726568ecdb9b9f7ab463b032835e66ac4","unresolved":false,"context_lines":[{"line_number":116,"context_line":"        return wsme.api.Response(ret, status_code\u003dhttp_client.CREATED,"},{"line_number":117,"context_line":"                                 return_type\u003dwsme.types.DictType)"},{"line_number":118,"context_line":""},{"line_number":119,"context_line":"    def _get_device_profile_list(self, names\u003d[], uuid\u003dNone):"},{"line_number":120,"context_line":"        \"\"\"Get a list of API objects representing device profiles.\"\"\""},{"line_number":121,"context_line":""},{"line_number":122,"context_line":"        context \u003d pecan.request.context"}],"source_content_type":"text/x-python","patch_set":15,"id":"7faddb67_9c0524c4","line":119,"range":{"start_line":119,"start_character":39,"end_line":119,"end_character":47},"in_reply_to":"7faddb67_1d92a759","updated":"2019-08-28 06:24:13.000000000","message":"Done","commit_id":"0e6964d5b8457a278746775cebd2e9e5e47e217f"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"ad8dc57c0577641177c7ca4d7d1930ff7b004cb1","unresolved":false,"context_lines":[{"line_number":121,"context_line":""},{"line_number":122,"context_line":"        context \u003d pecan.request.context"},{"line_number":123,"context_line":"        obj_devprofs \u003d objects.DeviceProfile.list(context)"},{"line_number":124,"context_line":"        if names !\u003d []:"},{"line_number":125,"context_line":"            new_obj_devprofs \u003d [devprof for devprof in obj_devprofs"},{"line_number":126,"context_line":"                                if devprof[\u0027name\u0027] in names]"},{"line_number":127,"context_line":"            obj_devprofs \u003d new_obj_devprofs"}],"source_content_type":"text/x-python","patch_set":15,"id":"7faddb67_bd8fd320","line":124,"range":{"start_line":124,"start_character":8,"end_line":124,"end_character":22},"updated":"2019-08-27 06:37:45.000000000","message":"Now this code is ok. I recommand a pythonic style like: \u0027if names:\u0027","commit_id":"0e6964d5b8457a278746775cebd2e9e5e47e217f"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"f00769e726568ecdb9b9f7ab463b032835e66ac4","unresolved":false,"context_lines":[{"line_number":121,"context_line":""},{"line_number":122,"context_line":"        context \u003d pecan.request.context"},{"line_number":123,"context_line":"        obj_devprofs \u003d objects.DeviceProfile.list(context)"},{"line_number":124,"context_line":"        if names !\u003d []:"},{"line_number":125,"context_line":"            new_obj_devprofs \u003d [devprof for devprof in obj_devprofs"},{"line_number":126,"context_line":"                                if devprof[\u0027name\u0027] in names]"},{"line_number":127,"context_line":"            obj_devprofs \u003d new_obj_devprofs"}],"source_content_type":"text/x-python","patch_set":15,"id":"7faddb67_3c0c30eb","line":124,"range":{"start_line":124,"start_character":8,"end_line":124,"end_character":22},"in_reply_to":"7faddb67_bd8fd320","updated":"2019-08-28 06:24:13.000000000","message":"Done","commit_id":"0e6964d5b8457a278746775cebd2e9e5e47e217f"},{"author":{"_account_id":30759,"name":"Shogo Saito","email":"shogo.saito.ac@hco.ntt.co.jp","username":"s.shogo"},"change_message_id":"4f2eb423176e773bed1ed312e6a152171926c164","unresolved":false,"context_lines":[{"line_number":175,"context_line":""},{"line_number":176,"context_line":"    # @policy.authorize_wsgi(\"cyborg:device_profile\", \"delete\")"},{"line_number":177,"context_line":"    @expose.expose(None, wtypes.text, status_code\u003dhttp_client.NO_CONTENT)"},{"line_number":178,"context_line":"    def delete(self, uuid):"},{"line_number":179,"context_line":"        \"\"\"Delete a device_profile."},{"line_number":180,"context_line":""},{"line_number":181,"context_line":"        :param uuid: UUID of a device_profile."}],"source_content_type":"text/x-python","patch_set":15,"id":"7faddb67_0e47fd20","line":178,"range":{"start_line":178,"start_character":0,"end_line":178,"end_character":27},"updated":"2019-08-23 07:08:30.000000000","message":"This function seems to be never called.\n(Python doesn\u0027t support overload. The latter delete() will be called always.)","commit_id":"0e6964d5b8457a278746775cebd2e9e5e47e217f"},{"author":{"_account_id":24872,"name":"YumengBao","email":"yumeng_bao@yahoo.com","username":"Yumeng_Bao"},"change_message_id":"65f9f2235a1ec52872b0ad78cb507cc41ce82b29","unresolved":false,"context_lines":[{"line_number":175,"context_line":""},{"line_number":176,"context_line":"    # @policy.authorize_wsgi(\"cyborg:device_profile\", \"delete\")"},{"line_number":177,"context_line":"    @expose.expose(None, wtypes.text, status_code\u003dhttp_client.NO_CONTENT)"},{"line_number":178,"context_line":"    def delete(self, uuid):"},{"line_number":179,"context_line":"        \"\"\"Delete a device_profile."},{"line_number":180,"context_line":""},{"line_number":181,"context_line":"        :param uuid: UUID of a device_profile."}],"source_content_type":"text/x-python","patch_set":15,"id":"7faddb67_48a7fb0a","line":178,"range":{"start_line":178,"start_character":0,"end_line":178,"end_character":27},"in_reply_to":"7faddb67_0e47fd20","updated":"2019-08-27 07:51:58.000000000","message":"yes, I also tested in my env, def delete(self, uuid) will never be called.","commit_id":"0e6964d5b8457a278746775cebd2e9e5e47e217f"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"f00769e726568ecdb9b9f7ab463b032835e66ac4","unresolved":false,"context_lines":[{"line_number":175,"context_line":""},{"line_number":176,"context_line":"    # @policy.authorize_wsgi(\"cyborg:device_profile\", \"delete\")"},{"line_number":177,"context_line":"    @expose.expose(None, wtypes.text, status_code\u003dhttp_client.NO_CONTENT)"},{"line_number":178,"context_line":"    def delete(self, uuid):"},{"line_number":179,"context_line":"        \"\"\"Delete a device_profile."},{"line_number":180,"context_line":""},{"line_number":181,"context_line":"        :param uuid: UUID of a device_profile."}],"source_content_type":"text/x-python","patch_set":15,"id":"7faddb67_bc6a607e","line":178,"range":{"start_line":178,"start_character":0,"end_line":178,"end_character":27},"in_reply_to":"7faddb67_48a7fb0a","updated":"2019-08-28 06:24:13.000000000","message":"Fixed this oversight.","commit_id":"0e6964d5b8457a278746775cebd2e9e5e47e217f"},{"author":{"_account_id":24872,"name":"YumengBao","email":"yumeng_bao@yahoo.com","username":"Yumeng_Bao"},"change_message_id":"65f9f2235a1ec52872b0ad78cb507cc41ce82b29","unresolved":false,"context_lines":[{"line_number":188,"context_line":""},{"line_number":189,"context_line":"    # @policy.authorize_wsgi(\"cyborg:device_profile\", \"delete\")"},{"line_number":190,"context_line":"    @expose.expose(None, wtypes.text, status_code\u003dhttp_client.NO_CONTENT)"},{"line_number":191,"context_line":"    def delete(self, names):"},{"line_number":192,"context_line":"        \"\"\"Delete a device_profile."},{"line_number":193,"context_line":""},{"line_number":194,"context_line":"        :param names: Comma-separated list of one or more names"}],"source_content_type":"text/x-python","patch_set":15,"id":"7faddb67_e88ee777","line":191,"range":{"start_line":191,"start_character":4,"end_line":191,"end_character":28},"updated":"2019-08-27 07:51:58.000000000","message":"For your reference, we can refactor def delete() like the following and add import oslo_utils.uuidutils.is_uuid_like in cyborg.common.utils, I have already tested in my env, it works fine. \n    def delete(self, value):\n        \"\"\"Delete a device_profile.\n\n        :param names: Comma-separated list of one or more names\n        TODO Support more than one devprof per request\n        \"\"\"\n        context \u003d pecan.request.context\n        if (common_utils.is_uuid_like(value)):\n            LOG.info(\u0027[device_profiles] delete. uuid\u003d%s\u0027, value)\n            # TODO Implement device profile delete via conductor\n            objects.DeviceProfile.delete_by_uuid(context, value)\n        else:\n            LOG.info(\u0027[device_profiles] delete. names\u003d%s\u0027, value)\n            # TODO Implement device profile delete via conductor\n            for name in value.split(\",\"):\n                objects.DeviceProfile.delete_by_name(context, name)","commit_id":"0e6964d5b8457a278746775cebd2e9e5e47e217f"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"f00769e726568ecdb9b9f7ab463b032835e66ac4","unresolved":false,"context_lines":[{"line_number":188,"context_line":""},{"line_number":189,"context_line":"    # @policy.authorize_wsgi(\"cyborg:device_profile\", \"delete\")"},{"line_number":190,"context_line":"    @expose.expose(None, wtypes.text, status_code\u003dhttp_client.NO_CONTENT)"},{"line_number":191,"context_line":"    def delete(self, names):"},{"line_number":192,"context_line":"        \"\"\"Delete a device_profile."},{"line_number":193,"context_line":""},{"line_number":194,"context_line":"        :param names: Comma-separated list of one or more names"}],"source_content_type":"text/x-python","patch_set":15,"id":"7faddb67_dc65dcb0","line":191,"range":{"start_line":191,"start_character":4,"end_line":191,"end_character":28},"in_reply_to":"7faddb67_e88ee777","updated":"2019-08-28 06:24:13.000000000","message":"Thanks, Yumeng.","commit_id":"0e6964d5b8457a278746775cebd2e9e5e47e217f"},{"author":{"_account_id":25738,"name":"Xinran WANG","email":"xin-ran.wang@intel.com","username":"Xinran"},"change_message_id":"6b3013b28f9312e3671bfe211a06009de393064b","unresolved":false,"context_lines":[{"line_number":110,"context_line":"        # TODO Support more than one devprof per request, if needed"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"        LOG.info(\"[device_profiles] POST request \u003d (%s)\", req_devprof_list)"},{"line_number":113,"context_line":"        if len(req_devprof_list) !\u003d 1:"},{"line_number":114,"context_line":"            raise exception.InvalidParameterValue("},{"line_number":115,"context_line":"                err\u003d\"Only one device profile allowed \""},{"line_number":116,"context_line":"                    \"per POST request for now.\")"}],"source_content_type":"text/x-python","patch_set":16,"id":"7faddb67_801fe007","line":113,"range":{"start_line":113,"start_character":10,"end_line":113,"end_character":32},"updated":"2019-08-29 03:35:25.000000000","message":"In POST method, the body is JSON format. len() is used for list usually. \nif you run len(body), you will get 2 as result. \n where body \u003d {\u0027name\u0027: \u0027Intel_FPGA\u0027, \u0027groups\u0027: [{\u0027resources:FPGA\u0027: \u00271\u0027}]}","commit_id":"950e515d9d15e3aff7af6b64311a8eef74217508"},{"author":{"_account_id":30759,"name":"Shogo Saito","email":"shogo.saito.ac@hco.ntt.co.jp","username":"s.shogo"},"change_message_id":"502fde0d37ba1bdcc43ed61ad1f2ee448335f177","unresolved":false,"context_lines":[{"line_number":110,"context_line":"        # TODO Support more than one devprof per request, if needed"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"        LOG.info(\"[device_profiles] POST request \u003d (%s)\", req_devprof_list)"},{"line_number":113,"context_line":"        if len(req_devprof_list) !\u003d 1:"},{"line_number":114,"context_line":"            raise exception.InvalidParameterValue("},{"line_number":115,"context_line":"                err\u003d\"Only one device profile allowed \""},{"line_number":116,"context_line":"                    \"per POST request for now.\")"}],"source_content_type":"text/x-python","patch_set":16,"id":"7faddb67_8bf5ad85","line":113,"range":{"start_line":113,"start_character":10,"end_line":113,"end_character":32},"in_reply_to":"7faddb67_26f1646b","updated":"2019-08-30 07:54:18.000000000","message":"As Xinran mentioned, len(req_devprof_list) returns 2 or 3, and this line is always evaluated as true.\nModified code like below works fine in my env.\nDoes this code make sense?\n\n%s/req_devprof_list/[req_devprof_list]/","commit_id":"950e515d9d15e3aff7af6b64311a8eef74217508"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"ed76fa308e5188833d057301d010d3f7657a66c5","unresolved":false,"context_lines":[{"line_number":110,"context_line":"        # TODO Support more than one devprof per request, if needed"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"        LOG.info(\"[device_profiles] POST request \u003d (%s)\", req_devprof_list)"},{"line_number":113,"context_line":"        if len(req_devprof_list) !\u003d 1:"},{"line_number":114,"context_line":"            raise exception.InvalidParameterValue("},{"line_number":115,"context_line":"                err\u003d\"Only one device profile allowed \""},{"line_number":116,"context_line":"                    \"per POST request for now.\")"}],"source_content_type":"text/x-python","patch_set":16,"id":"7faddb67_26f1646b","line":113,"range":{"start_line":113,"start_character":10,"end_line":113,"end_character":32},"in_reply_to":"7faddb67_801fe007","updated":"2019-08-29 08:21:17.000000000","message":"This version makes the API take a list of dictionaries, as documented in line 104 above, to allow for multiple device profiles to be created in one call.\n\nThe req_devprof_list is truly a list as seen in the output from the LOG.info above.","commit_id":"950e515d9d15e3aff7af6b64311a8eef74217508"},{"author":{"_account_id":24872,"name":"YumengBao","email":"yumeng_bao@yahoo.com","username":"Yumeng_Bao"},"change_message_id":"d93b5081b15d4d256f5b86dd88dd612a04233d92","unresolved":false,"context_lines":[{"line_number":110,"context_line":"        # TODO Support more than one devprof per request, if needed"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"        LOG.info(\"[device_profiles] POST request \u003d (%s)\", req_devprof_list)"},{"line_number":113,"context_line":"        if len(req_devprof_list) !\u003d 1:"},{"line_number":114,"context_line":"            raise exception.InvalidParameterValue("},{"line_number":115,"context_line":"                err\u003d\"Only one device profile allowed \""},{"line_number":116,"context_line":"                    \"per POST request for now.\")"}],"source_content_type":"text/x-python","patch_set":16,"id":"7faddb67_a0d50a45","line":113,"range":{"start_line":113,"start_character":10,"end_line":113,"end_character":32},"in_reply_to":"7faddb67_8bf5ad85","updated":"2019-09-02 09:59:52.000000000","message":"FYI, I tested with the following post request and it works fine: curl -g -i -X POST http://192.168.23.76/accelerator/v2/device_profiles -H \"Accept: application/json\" -H \"Content-Type: application/json\" -H \"User-Agent: None\" -H \"X-Auth-Token: yourtoken\" -d \u0027[{\"name\": \"Intel_FPGA\", \"groups\": [{\"resources:CUSTOM_ACCELERATOR_FPGA\": \"1\", \"trait:CUSTOM_FPGA_1\": \"required\", \"trait:CUSTOM_FUNCTION_ID_3AFB\": \"required\"}]}]\u0027","commit_id":"950e515d9d15e3aff7af6b64311a8eef74217508"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"96d75c7799d4459c224c614a0f59bab0dff72213","unresolved":false,"context_lines":[{"line_number":110,"context_line":"        # TODO Support more than one devprof per request, if needed"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"        LOG.info(\"[device_profiles] POST request \u003d (%s)\", req_devprof_list)"},{"line_number":113,"context_line":"        if len(req_devprof_list) !\u003d 1:"},{"line_number":114,"context_line":"            raise exception.InvalidParameterValue("},{"line_number":115,"context_line":"                err\u003d\"Only one device profile allowed \""},{"line_number":116,"context_line":"                    \"per POST request for now.\")"}],"source_content_type":"text/x-python","patch_set":16,"id":"7faddb67_dadb59e7","line":113,"range":{"start_line":113,"start_character":10,"end_line":113,"end_character":32},"in_reply_to":"7faddb67_8bf5ad85","updated":"2019-09-02 07:58:59.000000000","message":"I think you both are passing in a dictionary rather than a list of dictionaries, like [ {\u0027name\u0027: ..., \u0027groups\u0027: ...} ]. \n\nThe list form is documented in the spec [1].\n\n[1] https://specs.openstack.org/openstack/cyborg-specs/specs/train/approved/device-profiles.html#rest-api-impact","commit_id":"950e515d9d15e3aff7af6b64311a8eef74217508"},{"author":{"_account_id":30759,"name":"Shogo Saito","email":"shogo.saito.ac@hco.ntt.co.jp","username":"s.shogo"},"change_message_id":"35f5ba1839fdbf35d8ea0d7494ebb1a112841de0","unresolved":false,"context_lines":[{"line_number":110,"context_line":"        # TODO Support more than one devprof per request, if needed"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"        LOG.info(\"[device_profiles] POST request \u003d (%s)\", req_devprof_list)"},{"line_number":113,"context_line":"        if len(req_devprof_list) !\u003d 1:"},{"line_number":114,"context_line":"            raise exception.InvalidParameterValue("},{"line_number":115,"context_line":"                err\u003d\"Only one device profile allowed \""},{"line_number":116,"context_line":"                    \"per POST request for now.\")"}],"source_content_type":"text/x-python","patch_set":16,"id":"7faddb67_b5e0e328","line":113,"range":{"start_line":113,"start_character":10,"end_line":113,"end_character":32},"in_reply_to":"7faddb67_dadb59e7","updated":"2019-09-03 05:59:08.000000000","message":"Sorry, I got it.\nI found my mistake in my cyborg-pythonclient code,and fixing it, Thanks.","commit_id":"950e515d9d15e3aff7af6b64311a8eef74217508"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"b70e55ec1badef9f119aac9a4269544c21cdb850","unresolved":false,"context_lines":[{"line_number":195,"context_line":"        \"\"\"Retrieve a single device profile by name.\"\"\""},{"line_number":196,"context_line":"        LOG.info(\u0027[device_profiles] get_one. uuid\u003d%s\u0027, uuid)"},{"line_number":197,"context_line":"        api_obj_devprofs \u003d self._get_device_profile_list(uuid\u003duuid)"},{"line_number":198,"context_line":"        if len(api_obj_devprofs) \u003d\u003d 0:"},{"line_number":199,"context_line":"            raise exception.ResourceNotFound("},{"line_number":200,"context_line":"                resource\u003d\u0027Device profile\u0027,"},{"line_number":201,"context_line":"                msg\u003d\u0027with uuid %s\u0027 % uuid)"},{"line_number":202,"context_line":""},{"line_number":203,"context_line":"        count \u003d len(api_obj_devprofs)"},{"line_number":204,"context_line":"        if count !\u003d 1:  # Should never happen because names are unique"}],"source_content_type":"text/x-python","patch_set":16,"id":"7faddb67_5ad19e2e","line":201,"range":{"start_line":198,"start_character":0,"end_line":201,"end_character":42},"updated":"2019-09-03 03:47:27.000000000","message":"I think this part code will  not be executed because if uuid is wrong or not exist, db will raise 404 not found error[1].\nhttps://github.com/openstack/cyborg/blob/master/cyborg/db/sqlalchemy/api.py#L492","commit_id":"950e515d9d15e3aff7af6b64311a8eef74217508"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"ff833403fa1fc7598fc2eb1f7b619e06f5d0abab","unresolved":false,"context_lines":[{"line_number":195,"context_line":"        \"\"\"Retrieve a single device profile by name.\"\"\""},{"line_number":196,"context_line":"        LOG.info(\u0027[device_profiles] get_one. uuid\u003d%s\u0027, uuid)"},{"line_number":197,"context_line":"        api_obj_devprofs \u003d self._get_device_profile_list(uuid\u003duuid)"},{"line_number":198,"context_line":"        if len(api_obj_devprofs) \u003d\u003d 0:"},{"line_number":199,"context_line":"            raise exception.ResourceNotFound("},{"line_number":200,"context_line":"                resource\u003d\u0027Device profile\u0027,"},{"line_number":201,"context_line":"                msg\u003d\u0027with uuid %s\u0027 % uuid)"},{"line_number":202,"context_line":""},{"line_number":203,"context_line":"        count \u003d len(api_obj_devprofs)"},{"line_number":204,"context_line":"        if count !\u003d 1:  # Should never happen because names are unique"}],"source_content_type":"text/x-python","patch_set":16,"id":"7faddb67_babc52b5","line":201,"range":{"start_line":198,"start_character":0,"end_line":201,"end_character":42},"in_reply_to":"7faddb67_5ad19e2e","updated":"2019-09-03 04:37:34.000000000","message":"Umm, _get_device_profile_list reads all device profiles and filters based on uuid. So, it shouldn\u0027t crash in db.","commit_id":"950e515d9d15e3aff7af6b64311a8eef74217508"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"baaef59f8ade50bbb606831fe4e774c585df2bf0","unresolved":false,"context_lines":[{"line_number":195,"context_line":"        \"\"\"Retrieve a single device profile by name.\"\"\""},{"line_number":196,"context_line":"        LOG.info(\u0027[device_profiles] get_one. uuid\u003d%s\u0027, uuid)"},{"line_number":197,"context_line":"        api_obj_devprofs \u003d self._get_device_profile_list(uuid\u003duuid)"},{"line_number":198,"context_line":"        if len(api_obj_devprofs) \u003d\u003d 0:"},{"line_number":199,"context_line":"            raise exception.ResourceNotFound("},{"line_number":200,"context_line":"                resource\u003d\u0027Device profile\u0027,"},{"line_number":201,"context_line":"                msg\u003d\u0027with uuid %s\u0027 % uuid)"},{"line_number":202,"context_line":""},{"line_number":203,"context_line":"        count \u003d len(api_obj_devprofs)"},{"line_number":204,"context_line":"        if count !\u003d 1:  # Should never happen because names are unique"}],"source_content_type":"text/x-python","patch_set":16,"id":"7faddb67_d5a31f9a","line":201,"range":{"start_line":198,"start_character":0,"end_line":201,"end_character":42},"in_reply_to":"7faddb67_babc52b5","updated":"2019-09-03 06:27:49.000000000","message":"Yep. You are right.","commit_id":"950e515d9d15e3aff7af6b64311a8eef74217508"},{"author":{"_account_id":30759,"name":"Shogo Saito","email":"shogo.saito.ac@hco.ntt.co.jp","username":"s.shogo"},"change_message_id":"502fde0d37ba1bdcc43ed61ad1f2ee448335f177","unresolved":false,"context_lines":[{"line_number":204,"context_line":"        if count !\u003d 1:  # Should never happen because names are unique"},{"line_number":205,"context_line":"            raise exception.ExpectedOneObject(obj\u003d\u0027device profile\u0027,"},{"line_number":206,"context_line":"                                              count\u003dcount)"},{"line_number":207,"context_line":"        ret \u003d {\"device_profiles\": api_obj_devprofs[0]}"},{"line_number":208,"context_line":"        LOG.info(\u0027[device_profiles] get_one returned: %s\u0027, ret)"},{"line_number":209,"context_line":"        # TODO Replace this with convert_with_links() like other objects"},{"line_number":210,"context_line":"        return wsme.api.Response(ret, status_code\u003dhttp_client.OK,"}],"source_content_type":"text/x-python","patch_set":16,"id":"7faddb67_8b3a8d31","line":207,"range":{"start_line":207,"start_character":15,"end_line":207,"end_character":32},"updated":"2019-08-30 07:54:18.000000000","message":"In the cyborg train spec[1], this is expressd as a singular form , \"device_profile\".\nThis difference effects cyborg-client.\n\n\u003eNormal response code and body:\n\u003e200\n\u003e{ \u0027device_profile\u0027: \u003cdev-prof\u003e }\n\n[1] https://specs.openstack.org/openstack/cyborg-specs/specs/train/approved/device-profiles.html#rest-api-impact","commit_id":"950e515d9d15e3aff7af6b64311a8eef74217508"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"ff833403fa1fc7598fc2eb1f7b619e06f5d0abab","unresolved":false,"context_lines":[{"line_number":204,"context_line":"        if count !\u003d 1:  # Should never happen because names are unique"},{"line_number":205,"context_line":"            raise exception.ExpectedOneObject(obj\u003d\u0027device profile\u0027,"},{"line_number":206,"context_line":"                                              count\u003dcount)"},{"line_number":207,"context_line":"        ret \u003d {\"device_profiles\": api_obj_devprofs[0]}"},{"line_number":208,"context_line":"        LOG.info(\u0027[device_profiles] get_one returned: %s\u0027, ret)"},{"line_number":209,"context_line":"        # TODO Replace this with convert_with_links() like other objects"},{"line_number":210,"context_line":"        return wsme.api.Response(ret, status_code\u003dhttp_client.OK,"}],"source_content_type":"text/x-python","patch_set":16,"id":"7faddb67_5a043e7e","line":207,"range":{"start_line":207,"start_character":15,"end_line":207,"end_character":32},"in_reply_to":"7faddb67_7a602536","updated":"2019-09-03 04:37:34.000000000","message":"Done","commit_id":"950e515d9d15e3aff7af6b64311a8eef74217508"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"96d75c7799d4459c224c614a0f59bab0dff72213","unresolved":false,"context_lines":[{"line_number":204,"context_line":"        if count !\u003d 1:  # Should never happen because names are unique"},{"line_number":205,"context_line":"            raise exception.ExpectedOneObject(obj\u003d\u0027device profile\u0027,"},{"line_number":206,"context_line":"                                              count\u003dcount)"},{"line_number":207,"context_line":"        ret \u003d {\"device_profiles\": api_obj_devprofs[0]}"},{"line_number":208,"context_line":"        LOG.info(\u0027[device_profiles] get_one returned: %s\u0027, ret)"},{"line_number":209,"context_line":"        # TODO Replace this with convert_with_links() like other objects"},{"line_number":210,"context_line":"        return wsme.api.Response(ret, status_code\u003dhttp_client.OK,"}],"source_content_type":"text/x-python","patch_set":16,"id":"7faddb67_7a602536","line":207,"range":{"start_line":207,"start_character":15,"end_line":207,"end_character":32},"in_reply_to":"7faddb67_8b3a8d31","updated":"2019-09-02 07:58:59.000000000","message":"Good catch. Will fix.","commit_id":"950e515d9d15e3aff7af6b64311a8eef74217508"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"b70e55ec1badef9f119aac9a4269544c21cdb850","unresolved":false,"context_lines":[{"line_number":211,"context_line":"                                 return_type\u003dwsme.types.DictType)"},{"line_number":212,"context_line":""},{"line_number":213,"context_line":"    # @policy.authorize_wsgi(\"cyborg:device_profile\", \"delete\")"},{"line_number":214,"context_line":"    @expose.expose(None, wtypes.text, wtypes.text,"},{"line_number":215,"context_line":"                   status_code\u003dhttp_client.NO_CONTENT)"},{"line_number":216,"context_line":"    def delete(self, value):"},{"line_number":217,"context_line":"        \"\"\"Delete one or more device_profiles."}],"source_content_type":"text/x-python","patch_set":16,"id":"7faddb67_da482e2f","line":214,"range":{"start_line":214,"start_character":37,"end_line":214,"end_character":50},"updated":"2019-09-03 03:47:27.000000000","message":"This should be deleted.","commit_id":"950e515d9d15e3aff7af6b64311a8eef74217508"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"ff833403fa1fc7598fc2eb1f7b619e06f5d0abab","unresolved":false,"context_lines":[{"line_number":211,"context_line":"                                 return_type\u003dwsme.types.DictType)"},{"line_number":212,"context_line":""},{"line_number":213,"context_line":"    # @policy.authorize_wsgi(\"cyborg:device_profile\", \"delete\")"},{"line_number":214,"context_line":"    @expose.expose(None, wtypes.text, wtypes.text,"},{"line_number":215,"context_line":"                   status_code\u003dhttp_client.NO_CONTENT)"},{"line_number":216,"context_line":"    def delete(self, value):"},{"line_number":217,"context_line":"        \"\"\"Delete one or more device_profiles."}],"source_content_type":"text/x-python","patch_set":16,"id":"7faddb67_1ae1e6cf","line":214,"range":{"start_line":214,"start_character":37,"end_line":214,"end_character":50},"in_reply_to":"7faddb67_da482e2f","updated":"2019-09-03 04:37:34.000000000","message":"Done","commit_id":"950e515d9d15e3aff7af6b64311a8eef74217508"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"b70e55ec1badef9f119aac9a4269544c21cdb850","unresolved":false,"context_lines":[{"line_number":218,"context_line":""},{"line_number":219,"context_line":"        URL: /device_profiles/{uuid} OR /device_profiles?names\u003dfoo,bar"},{"line_number":220,"context_line":""},{"line_number":221,"context_line":"        :param uuid: UUID of a device_profile."},{"line_number":222,"context_line":"        :param names: Comma-delimited list of device profile names."},{"line_number":223,"context_line":"        \"\"\""},{"line_number":224,"context_line":"        context \u003d pecan.request.context"},{"line_number":225,"context_line":"        if uuidutils.is_uuid_like(value):"}],"source_content_type":"text/x-python","patch_set":16,"id":"7faddb67_97012f0a","line":222,"range":{"start_line":221,"start_character":8,"end_line":222,"end_character":67},"updated":"2019-09-03 03:47:27.000000000","message":"Hi, Sundar Nadathur. Overall this looks good to me. yet the parameter here is value, we directly write the parameters uuid and name are not suitable, I think. Maybe we could put this content in the interpretation of the parameter value.","commit_id":"950e515d9d15e3aff7af6b64311a8eef74217508"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"ff833403fa1fc7598fc2eb1f7b619e06f5d0abab","unresolved":false,"context_lines":[{"line_number":218,"context_line":""},{"line_number":219,"context_line":"        URL: /device_profiles/{uuid} OR /device_profiles?names\u003dfoo,bar"},{"line_number":220,"context_line":""},{"line_number":221,"context_line":"        :param uuid: UUID of a device_profile."},{"line_number":222,"context_line":"        :param names: Comma-delimited list of device profile names."},{"line_number":223,"context_line":"        \"\"\""},{"line_number":224,"context_line":"        context \u003d pecan.request.context"},{"line_number":225,"context_line":"        if uuidutils.is_uuid_like(value):"}],"source_content_type":"text/x-python","patch_set":16,"id":"7faddb67_facbaa46","line":222,"range":{"start_line":221,"start_character":8,"end_line":222,"end_character":67},"in_reply_to":"7faddb67_97012f0a","updated":"2019-09-03 04:37:34.000000000","message":"Done","commit_id":"950e515d9d15e3aff7af6b64311a8eef74217508"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"b70e55ec1badef9f119aac9a4269544c21cdb850","unresolved":false,"context_lines":[{"line_number":228,"context_line":"            # TODO Implement device profile delete via conductor"},{"line_number":229,"context_line":"            objects.DeviceProfile.delete_by_uuid(context, uuid)"},{"line_number":230,"context_line":"        else:"},{"line_number":231,"context_line":"            names \u003d value"},{"line_number":232,"context_line":"            LOG.info(\u0027[device_profiles] delete names\u003d(%s)\u0027, names)"},{"line_number":233,"context_line":"            for name in names.split(\",\"):"},{"line_number":234,"context_line":"                objects.DeviceProfile.delete_by_name(context, name)"}],"source_content_type":"text/x-python","patch_set":16,"id":"7faddb67_7a31faa1","line":233,"range":{"start_line":231,"start_character":0,"end_line":233,"end_character":41},"updated":"2019-09-03 03:47:27.000000000","message":"suggest: \n            names \u003d value.split(\u0027,\u0027)\n            LOG.info(\u0027[device_profiles] delete names\u003d(%s)\u0027, names)\n            for name in names:\n....\nThe same style like get_all Line 183.","commit_id":"950e515d9d15e3aff7af6b64311a8eef74217508"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"ff833403fa1fc7598fc2eb1f7b619e06f5d0abab","unresolved":false,"context_lines":[{"line_number":228,"context_line":"            # TODO Implement device profile delete via conductor"},{"line_number":229,"context_line":"            objects.DeviceProfile.delete_by_uuid(context, uuid)"},{"line_number":230,"context_line":"        else:"},{"line_number":231,"context_line":"            names \u003d value"},{"line_number":232,"context_line":"            LOG.info(\u0027[device_profiles] delete names\u003d(%s)\u0027, names)"},{"line_number":233,"context_line":"            for name in names.split(\",\"):"},{"line_number":234,"context_line":"                objects.DeviceProfile.delete_by_name(context, name)"}],"source_content_type":"text/x-python","patch_set":16,"id":"7faddb67_9ad4f6eb","line":233,"range":{"start_line":231,"start_character":0,"end_line":233,"end_character":41},"in_reply_to":"7faddb67_7a31faa1","updated":"2019-09-03 04:37:34.000000000","message":"Done","commit_id":"950e515d9d15e3aff7af6b64311a8eef74217508"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"61f979f23e3c2ca3da3c289bc6b7d20543907beb","unresolved":false,"context_lines":[{"line_number":134,"context_line":""},{"line_number":135,"context_line":"        name \u003d req_devprof.get(\"name\")"},{"line_number":136,"context_line":"        if not name:"},{"line_number":137,"context_line":"            raise exceptio.DeviceProfileNameNeeded()"},{"line_number":138,"context_line":"        elif not re.match(NAME, name):"},{"line_number":139,"context_line":"            raise exception.InvalidParameterValue("},{"line_number":140,"context_line":"                err\u003d\"Device profile name must be of the form %s\" % NAME)"}],"source_content_type":"text/x-python","patch_set":20,"id":"7faddb67_679aa86f","line":137,"range":{"start_line":137,"start_character":24,"end_line":137,"end_character":26},"updated":"2019-09-04 08:17:32.000000000","message":"exception","commit_id":"89dfc93bd1c7c19618def2e89e7aac0fc5fd3eca"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"1054b2782cfd69f00ed47cba6b52609a426d38b2","unresolved":false,"context_lines":[{"line_number":134,"context_line":""},{"line_number":135,"context_line":"        name \u003d req_devprof.get(\"name\")"},{"line_number":136,"context_line":"        if not name:"},{"line_number":137,"context_line":"            raise exceptio.DeviceProfileNameNeeded()"},{"line_number":138,"context_line":"        elif not re.match(NAME, name):"},{"line_number":139,"context_line":"            raise exception.InvalidParameterValue("},{"line_number":140,"context_line":"                err\u003d\"Device profile name must be of the form %s\" % NAME)"}],"source_content_type":"text/x-python","patch_set":20,"id":"7faddb67_f2417864","line":137,"range":{"start_line":137,"start_character":24,"end_line":137,"end_character":26},"in_reply_to":"7faddb67_679aa86f","updated":"2019-09-04 10:28:37.000000000","message":"Thanks, good eyes.","commit_id":"89dfc93bd1c7c19618def2e89e7aac0fc5fd3eca"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"61f979f23e3c2ca3da3c289bc6b7d20543907beb","unresolved":false,"context_lines":[{"line_number":191,"context_line":""},{"line_number":192,"context_line":"    # @policy.authorize_wsgi(\"cyborg:device_profile\", \"get_one\")"},{"line_number":193,"context_line":"    @expose.expose(\u0027json\u0027, wtypes.text)"},{"line_number":194,"context_line":"    def get_one(self, uuid):"},{"line_number":195,"context_line":"        \"\"\"Retrieve a single device profile by name.\"\"\""},{"line_number":196,"context_line":"        LOG.info(\u0027[device_profiles] get_one. uuid\u003d%s\u0027, uuid)"},{"line_number":197,"context_line":"        api_obj_devprofs \u003d self._get_device_profile_list(uuid\u003duuid)"},{"line_number":198,"context_line":"        if len(api_obj_devprofs) \u003d\u003d 0:"}],"source_content_type":"text/x-python","patch_set":20,"id":"7faddb67_2714b09f","line":195,"range":{"start_line":194,"start_character":0,"end_line":195,"end_character":55},"updated":"2019-09-04 08:17:32.000000000","message":"I guess this get_one will support uuid or names. Suggest Add TODO","commit_id":"89dfc93bd1c7c19618def2e89e7aac0fc5fd3eca"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"1054b2782cfd69f00ed47cba6b52609a426d38b2","unresolved":false,"context_lines":[{"line_number":191,"context_line":""},{"line_number":192,"context_line":"    # @policy.authorize_wsgi(\"cyborg:device_profile\", \"get_one\")"},{"line_number":193,"context_line":"    @expose.expose(\u0027json\u0027, wtypes.text)"},{"line_number":194,"context_line":"    def get_one(self, uuid):"},{"line_number":195,"context_line":"        \"\"\"Retrieve a single device profile by name.\"\"\""},{"line_number":196,"context_line":"        LOG.info(\u0027[device_profiles] get_one. uuid\u003d%s\u0027, uuid)"},{"line_number":197,"context_line":"        api_obj_devprofs \u003d self._get_device_profile_list(uuid\u003duuid)"},{"line_number":198,"context_line":"        if len(api_obj_devprofs) \u003d\u003d 0:"}],"source_content_type":"text/x-python","patch_set":20,"id":"7faddb67_9250442e","line":195,"range":{"start_line":194,"start_character":0,"end_line":195,"end_character":55},"in_reply_to":"7faddb67_2714b09f","updated":"2019-09-04 10:28:37.000000000","message":"The intention is that we support: /device_profiles/{uuid} and /device/profiles?names\u003d....","commit_id":"89dfc93bd1c7c19618def2e89e7aac0fc5fd3eca"},{"author":{"_account_id":24872,"name":"YumengBao","email":"yumeng_bao@yahoo.com","username":"Yumeng_Bao"},"change_message_id":"d95a38969328406173868cef9fc5345300fe642c","unresolved":false,"context_lines":[{"line_number":207,"context_line":"    def delete(self, value):"},{"line_number":208,"context_line":"        \"\"\"Delete one or more device_profiles."},{"line_number":209,"context_line":""},{"line_number":210,"context_line":"        URL: /device_profiles/{uuid} OR /device_profiles?names\u003dfoo,bar"},{"line_number":211,"context_line":""},{"line_number":212,"context_line":"        :param value: Tis should be one of these two:"},{"line_number":213,"context_line":"            - UUID of a device_profile."}],"source_content_type":"text/x-python","patch_set":23,"id":"7faddb67_14c8b9a5","line":210,"range":{"start_line":210,"start_character":8,"end_line":210,"end_character":70},"updated":"2019-09-04 15:35:13.000000000","message":"I have successfully tested URL: /device_profiles/{name} but failed on /device_profiles?names\u003dfoo,bar. Is there an intention or just a convention to use /device_profiles?names\u003dfoo,bar?\nBTW, I was wondering why do we need to delete multiple device profiles by names but only one by uuid ?","commit_id":"560b1052fb169c63343b738c3ce3177e93957654"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"dccd9f6c2aeed5667416510ad814877ffcfaf719","unresolved":false,"context_lines":[{"line_number":207,"context_line":"    def delete(self, value):"},{"line_number":208,"context_line":"        \"\"\"Delete one or more device_profiles."},{"line_number":209,"context_line":""},{"line_number":210,"context_line":"        URL: /device_profiles/{uuid} OR /device_profiles?names\u003dfoo,bar"},{"line_number":211,"context_line":""},{"line_number":212,"context_line":"        :param value: Tis should be one of these two:"},{"line_number":213,"context_line":"            - UUID of a device_profile."}],"source_content_type":"text/x-python","patch_set":23,"id":"7faddb67_40418435","line":210,"range":{"start_line":210,"start_character":8,"end_line":210,"end_character":70},"in_reply_to":"7faddb67_14c8b9a5","updated":"2019-09-04 20:28:16.000000000","message":"The comment should say: ?value\u003dfoo,bar. Thanks for catching this.\n\nThe Cyborg REST API have been designed for collections, i.e., they can manipulate more than one object at a time for efficiency. That is because it is easier to use a N-object API for N\u003d1 than to use a 1-object API for multiple objects. However, based on feedback from Cyborg folks and others, I also added uuid as a primary key, so that we can get/delete a single device profile by uuid. This can be useful if we want to allow renaming of device profiles in the future.\n\nThe convention is to address single objects by uuid. Multiple objects are addressed by name because that is most user-friendly, but we are not precluding having value\u003duuid1,uuid2,... in the future.","commit_id":"560b1052fb169c63343b738c3ce3177e93957654"}],"cyborg/objects/device_profile.py":[{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"61f979f23e3c2ca3da3c289bc6b7d20543907beb","unresolved":false,"context_lines":[{"line_number":63,"context_line":"        self._from_db_object(self, db_devprof)"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"    @classmethod"},{"line_number":66,"context_line":"    def get(cls, context, name):"},{"line_number":67,"context_line":"        \"\"\"Find a DB Device Profile and return an Obj Device Profile.\"\"\""},{"line_number":68,"context_line":"        db_devprof \u003d cls.dbapi.device_profile_get(context, name)"},{"line_number":69,"context_line":"        obj_devprof \u003d cls._from_db_object(cls(context), db_devprof)"}],"source_content_type":"text/x-python","patch_set":20,"id":"7faddb67_e7577859","line":66,"range":{"start_line":66,"start_character":8,"end_line":66,"end_character":32},"updated":"2019-09-04 08:17:32.000000000","message":"Do we need to choose by name or uuid?","commit_id":"89dfc93bd1c7c19618def2e89e7aac0fc5fd3eca"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"1054b2782cfd69f00ed47cba6b52609a426d38b2","unresolved":false,"context_lines":[{"line_number":63,"context_line":"        self._from_db_object(self, db_devprof)"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"    @classmethod"},{"line_number":66,"context_line":"    def get(cls, context, name):"},{"line_number":67,"context_line":"        \"\"\"Find a DB Device Profile and return an Obj Device Profile.\"\"\""},{"line_number":68,"context_line":"        db_devprof \u003d cls.dbapi.device_profile_get(context, name)"},{"line_number":69,"context_line":"        obj_devprof \u003d cls._from_db_object(cls(context), db_devprof)"}],"source_content_type":"text/x-python","patch_set":20,"id":"7faddb67_6da7e951","line":66,"range":{"start_line":66,"start_character":8,"end_line":66,"end_character":32},"in_reply_to":"7faddb67_e7577859","updated":"2019-09-04 10:28:37.000000000","message":"This is by name because Nova is the primary client of Cyborg today and it queries by single device profile name.","commit_id":"89dfc93bd1c7c19618def2e89e7aac0fc5fd3eca"},{"author":{"_account_id":24872,"name":"YumengBao","email":"yumeng_bao@yahoo.com","username":"Yumeng_Bao"},"change_message_id":"d95a38969328406173868cef9fc5345300fe642c","unresolved":false,"context_lines":[{"line_number":63,"context_line":"        self._from_db_object(self, db_devprof)"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"    @classmethod"},{"line_number":66,"context_line":"    def get(cls, context, name):"},{"line_number":67,"context_line":"        \"\"\"Find a DB Device Profile and return an Obj Device Profile.\"\"\""},{"line_number":68,"context_line":"        db_devprof \u003d cls.dbapi.device_profile_get(context, name)"},{"line_number":69,"context_line":"        obj_devprof \u003d cls._from_db_object(cls(context), db_devprof)"}],"source_content_type":"text/x-python","patch_set":23,"id":"7faddb67_19aeb480","line":66,"range":{"start_line":66,"start_character":7,"end_line":66,"end_character":32},"updated":"2019-09-04 15:35:13.000000000","message":"IMO, operators may want to either get a device_profile by name or by uuid just like nova flavor-show id/name does. although nova is the primary client of Cyborg for now, we will also have a device_profile client for operators to retrieve the objects. but we can add a TODO if we don\u0027t have enough time to update temporarily.","commit_id":"560b1052fb169c63343b738c3ce3177e93957654"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"dccd9f6c2aeed5667416510ad814877ffcfaf719","unresolved":false,"context_lines":[{"line_number":63,"context_line":"        self._from_db_object(self, db_devprof)"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"    @classmethod"},{"line_number":66,"context_line":"    def get(cls, context, name):"},{"line_number":67,"context_line":"        \"\"\"Find a DB Device Profile and return an Obj Device Profile.\"\"\""},{"line_number":68,"context_line":"        db_devprof \u003d cls.dbapi.device_profile_get(context, name)"},{"line_number":69,"context_line":"        obj_devprof \u003d cls._from_db_object(cls(context), db_devprof)"}],"source_content_type":"text/x-python","patch_set":23,"id":"7faddb67_40af44df","line":66,"range":{"start_line":66,"start_character":7,"end_line":66,"end_character":32},"in_reply_to":"7faddb67_19aeb480","updated":"2019-09-04 20:28:16.000000000","message":"Agreed. We can get a single device profile by UUID today, by doing list() (below in line 74) and filtering on UUID. In fact, the get_one API does that.","commit_id":"560b1052fb169c63343b738c3ce3177e93957654"},{"author":{"_account_id":20722,"name":"Yikun Jiang","email":"yikunkero@gmail.com","username":"yikunkero"},"change_message_id":"1f9c0c136d46c20ecd6646bb78efdace66c3c198","unresolved":false,"context_lines":[{"line_number":31,"context_line":"    # Version 1.0: Initial version"},{"line_number":32,"context_line":"    VERSION \u003d \u00271.0\u0027"},{"line_number":33,"context_line":""},{"line_number":34,"context_line":"    dbapi \u003d dbapi.get_instance()"},{"line_number":35,"context_line":""},{"line_number":36,"context_line":"    fields \u003d {"},{"line_number":37,"context_line":"        \u0027id\u0027: object_fields.IntegerField(nullable\u003dFalse),"}],"source_content_type":"text/x-python","patch_set":25,"id":"7faddb67_68649be5","line":34,"range":{"start_line":34,"start_character":4,"end_line":34,"end_character":9},"updated":"2019-09-05 11:50:25.000000000","message":"nit: we always call the dbapi as \"db\".","commit_id":"65ae01925327d9b2f1be8ef836a3fbffc2c8ae1e"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"33c54082429a8217cfaeaca388676596a2890781","unresolved":false,"context_lines":[{"line_number":31,"context_line":"    # Version 1.0: Initial version"},{"line_number":32,"context_line":"    VERSION \u003d \u00271.0\u0027"},{"line_number":33,"context_line":""},{"line_number":34,"context_line":"    dbapi \u003d dbapi.get_instance()"},{"line_number":35,"context_line":""},{"line_number":36,"context_line":"    fields \u003d {"},{"line_number":37,"context_line":"        \u0027id\u0027: object_fields.IntegerField(nullable\u003dFalse),"}],"source_content_type":"text/x-python","patch_set":25,"id":"7faddb67_48275f13","line":34,"range":{"start_line":34,"start_character":4,"end_line":34,"end_character":9},"in_reply_to":"7faddb67_68649be5","updated":"2019-09-05 14:09:47.000000000","message":"nit back :): Other object files use the same name. But I can change it if others agree.\n\nE.g. https://opendev.org/openstack/cyborg/src/branch/master/cyborg/objects/control_path.py#L35","commit_id":"65ae01925327d9b2f1be8ef836a3fbffc2c8ae1e"},{"author":{"_account_id":20722,"name":"Yikun Jiang","email":"yikunkero@gmail.com","username":"yikunkero"},"change_message_id":"1f9c0c136d46c20ecd6646bb78efdace66c3c198","unresolved":false,"context_lines":[{"line_number":82,"context_line":"        updates \u003d self.obj_get_changes()"},{"line_number":83,"context_line":"        self._to_profile_json(updates)"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"        db_devprof \u003d self.dbapi.device_profile_update(context,"},{"line_number":86,"context_line":"                                                      self.name, updates)"},{"line_number":87,"context_line":"        self._from_db_object(self, db_devprof)"},{"line_number":88,"context_line":""}],"source_content_type":"text/x-python","patch_set":25,"id":"7faddb67_e8788b8f","line":85,"updated":"2019-09-05 11:50:25.000000000","message":"I guess we need catch the exception from  db.device_profile_update","commit_id":"65ae01925327d9b2f1be8ef836a3fbffc2c8ae1e"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"33c54082429a8217cfaeaca388676596a2890781","unresolved":false,"context_lines":[{"line_number":82,"context_line":"        updates \u003d self.obj_get_changes()"},{"line_number":83,"context_line":"        self._to_profile_json(updates)"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"        db_devprof \u003d self.dbapi.device_profile_update(context,"},{"line_number":86,"context_line":"                                                      self.name, updates)"},{"line_number":87,"context_line":"        self._from_db_object(self, db_devprof)"},{"line_number":88,"context_line":""}],"source_content_type":"text/x-python","patch_set":25,"id":"7faddb67_2bb69d26","line":85,"in_reply_to":"7faddb67_e8788b8f","updated":"2019-09-05 14:09:47.000000000","message":"The db method can raise InvalidParameterValue or DuplicateDeviceProfileName. if we catch them, we just have to reraise them again, right? Are you thinking of some other action?","commit_id":"65ae01925327d9b2f1be8ef836a3fbffc2c8ae1e"},{"author":{"_account_id":20722,"name":"Yikun Jiang","email":"yikunkero@gmail.com","username":"yikunkero"},"change_message_id":"1f9c0c136d46c20ecd6646bb78efdace66c3c198","unresolved":false,"context_lines":[{"line_number":89,"context_line":"    def destroy(self, context):"},{"line_number":90,"context_line":"        \"\"\"Delete a Device Profile from the DB.\"\"\""},{"line_number":91,"context_line":"        self.dbapi.device_profile_delete(context, self.uuid)"},{"line_number":92,"context_line":"        self.obj_reset_changes()"},{"line_number":93,"context_line":""},{"line_number":94,"context_line":"    @classmethod"},{"line_number":95,"context_line":"    def delete_by_name(cls, context, name):"}],"source_content_type":"text/x-python","patch_set":25,"id":"7faddb67_2813035b","line":92,"range":{"start_line":92,"start_character":8,"end_line":92,"end_character":32},"updated":"2019-09-05 11:50:25.000000000","message":"Why we need it?","commit_id":"65ae01925327d9b2f1be8ef836a3fbffc2c8ae1e"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"33c54082429a8217cfaeaca388676596a2890781","unresolved":false,"context_lines":[{"line_number":89,"context_line":"    def destroy(self, context):"},{"line_number":90,"context_line":"        \"\"\"Delete a Device Profile from the DB.\"\"\""},{"line_number":91,"context_line":"        self.dbapi.device_profile_delete(context, self.uuid)"},{"line_number":92,"context_line":"        self.obj_reset_changes()"},{"line_number":93,"context_line":""},{"line_number":94,"context_line":"    @classmethod"},{"line_number":95,"context_line":"    def delete_by_name(cls, context, name):"}],"source_content_type":"text/x-python","patch_set":25,"id":"7faddb67_8857975a","line":92,"range":{"start_line":92,"start_character":8,"end_line":92,"end_character":32},"in_reply_to":"7faddb67_2813035b","updated":"2019-09-05 14:09:47.000000000","message":"The destroy() methods for other objects do this too. I think it is needed because any attempt to access the object after this (which should be illegal) will not see stale values.","commit_id":"65ae01925327d9b2f1be8ef836a3fbffc2c8ae1e"},{"author":{"_account_id":20722,"name":"Yikun Jiang","email":"yikunkero@gmail.com","username":"yikunkero"},"change_message_id":"1f9c0c136d46c20ecd6646bb78efdace66c3c198","unresolved":false,"context_lines":[{"line_number":93,"context_line":""},{"line_number":94,"context_line":"    @classmethod"},{"line_number":95,"context_line":"    def delete_by_name(cls, context, name):"},{"line_number":96,"context_line":"        obj_devprof \u003d DeviceProfile.get(context, name)"},{"line_number":97,"context_line":"        if obj_devprof:"},{"line_number":98,"context_line":"            obj_devprof.destroy(context)"},{"line_number":99,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":25,"id":"7faddb67_6836dbe9","line":96,"updated":"2019-09-05 11:50:25.000000000","message":"https://review.opendev.org/#/c/677115/12/cyborg/db/sqlalchemy/api.py@489\n\nthe \"DeviceProfileNotFound\" will be raised in here, we need catch this exception and rasie the resource not found","commit_id":"65ae01925327d9b2f1be8ef836a3fbffc2c8ae1e"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"33c54082429a8217cfaeaca388676596a2890781","unresolved":false,"context_lines":[{"line_number":93,"context_line":""},{"line_number":94,"context_line":"    @classmethod"},{"line_number":95,"context_line":"    def delete_by_name(cls, context, name):"},{"line_number":96,"context_line":"        obj_devprof \u003d DeviceProfile.get(context, name)"},{"line_number":97,"context_line":"        if obj_devprof:"},{"line_number":98,"context_line":"            obj_devprof.destroy(context)"},{"line_number":99,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":25,"id":"7faddb67_8ba6b1bf","line":96,"in_reply_to":"7faddb67_6836dbe9","updated":"2019-09-05 14:09:47.000000000","message":"The db api may raise exception.DeviceProfileNotFound(name\u003dname) [1]. If we catch that, we just have to raise the same exception again. \nBut I agree the else clause is not reachable -- will fix that.\n\n[1] https://opendev.org/openstack/cyborg/src/branch/master/cyborg/db/sqlalchemy/api.py#L509","commit_id":"65ae01925327d9b2f1be8ef836a3fbffc2c8ae1e"},{"author":{"_account_id":20722,"name":"Yikun Jiang","email":"yikunkero@gmail.com","username":"yikunkero"},"change_message_id":"1f9c0c136d46c20ecd6646bb78efdace66c3c198","unresolved":false,"context_lines":[{"line_number":97,"context_line":"        if obj_devprof:"},{"line_number":98,"context_line":"            obj_devprof.destroy(context)"},{"line_number":99,"context_line":"        else:"},{"line_number":100,"context_line":"            raise exception.ResourceNotFound(resource\u003d\u0027Device profile\u0027,"},{"line_number":101,"context_line":"                                             msg\u003d\u0027with name %s\u0027 % name)"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    @classmethod"}],"source_content_type":"text/x-python","patch_set":25,"id":"7faddb67_c84caf77","line":100,"updated":"2019-09-05 11:50:25.000000000","message":"As L96 comments, this else will never reached.","commit_id":"65ae01925327d9b2f1be8ef836a3fbffc2c8ae1e"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"33c54082429a8217cfaeaca388676596a2890781","unresolved":false,"context_lines":[{"line_number":97,"context_line":"        if obj_devprof:"},{"line_number":98,"context_line":"            obj_devprof.destroy(context)"},{"line_number":99,"context_line":"        else:"},{"line_number":100,"context_line":"            raise exception.ResourceNotFound(resource\u003d\u0027Device profile\u0027,"},{"line_number":101,"context_line":"                                             msg\u003d\u0027with name %s\u0027 % name)"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    @classmethod"}],"source_content_type":"text/x-python","patch_set":25,"id":"7faddb67_2b953d3d","line":100,"in_reply_to":"7faddb67_c84caf77","updated":"2019-09-05 14:09:47.000000000","message":"Done","commit_id":"65ae01925327d9b2f1be8ef836a3fbffc2c8ae1e"},{"author":{"_account_id":20722,"name":"Yikun Jiang","email":"yikunkero@gmail.com","username":"yikunkero"},"change_message_id":"1f9c0c136d46c20ecd6646bb78efdace66c3c198","unresolved":false,"context_lines":[{"line_number":107,"context_line":"        if obj_devprof:"},{"line_number":108,"context_line":"            obj_devprof.destroy(context)"},{"line_number":109,"context_line":"        else:"},{"line_number":110,"context_line":"            raise exception.DeviceProfileNotFound(uuid\u003duuid)"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"    @classmethod"},{"line_number":113,"context_line":"    def _from_db_object(cls, obj, db_obj):"}],"source_content_type":"text/x-python","patch_set":25,"id":"7faddb67_683b3bc7","line":110,"updated":"2019-09-05 11:50:25.000000000","message":"https://review.opendev.org/#/c/677115/12/cyborg/db/sqlalchemy/api.py@563\n\nsame issue.","commit_id":"65ae01925327d9b2f1be8ef836a3fbffc2c8ae1e"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"33c54082429a8217cfaeaca388676596a2890781","unresolved":false,"context_lines":[{"line_number":107,"context_line":"        if obj_devprof:"},{"line_number":108,"context_line":"            obj_devprof.destroy(context)"},{"line_number":109,"context_line":"        else:"},{"line_number":110,"context_line":"            raise exception.DeviceProfileNotFound(uuid\u003duuid)"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"    @classmethod"},{"line_number":113,"context_line":"    def _from_db_object(cls, obj, db_obj):"}],"source_content_type":"text/x-python","patch_set":25,"id":"7faddb67_8b7eb1e0","line":110,"in_reply_to":"7faddb67_683b3bc7","updated":"2019-09-05 14:09:47.000000000","message":"Done","commit_id":"65ae01925327d9b2f1be8ef836a3fbffc2c8ae1e"},{"author":{"_account_id":20722,"name":"Yikun Jiang","email":"yikunkero@gmail.com","username":"yikunkero"},"change_message_id":"1f9c0c136d46c20ecd6646bb78efdace66c3c198","unresolved":false,"context_lines":[{"line_number":120,"context_line":"        # Convert from profile_json to \u0027groups\u0027 ListOfDictOfStrings"},{"line_number":121,"context_line":"        d \u003d jsonutils.loads(db_obj[\u0027profile_json\u0027])"},{"line_number":122,"context_line":"        db_obj[\u0027groups\u0027] \u003d d[\u0027groups\u0027]"},{"line_number":123,"context_line":"        # db_obj.pop(\u0027profile_json\u0027, None)"},{"line_number":124,"context_line":""},{"line_number":125,"context_line":"        obj \u003d base.CyborgObject._from_db_object(obj, db_obj)"},{"line_number":126,"context_line":"        return obj"}],"source_content_type":"text/x-python","patch_set":25,"id":"7faddb67_08464751","line":123,"range":{"start_line":123,"start_character":8,"end_line":123,"end_character":42},"updated":"2019-09-05 11:50:25.000000000","message":"need cleanup","commit_id":"65ae01925327d9b2f1be8ef836a3fbffc2c8ae1e"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"33c54082429a8217cfaeaca388676596a2890781","unresolved":false,"context_lines":[{"line_number":120,"context_line":"        # Convert from profile_json to \u0027groups\u0027 ListOfDictOfStrings"},{"line_number":121,"context_line":"        d \u003d jsonutils.loads(db_obj[\u0027profile_json\u0027])"},{"line_number":122,"context_line":"        db_obj[\u0027groups\u0027] \u003d d[\u0027groups\u0027]"},{"line_number":123,"context_line":"        # db_obj.pop(\u0027profile_json\u0027, None)"},{"line_number":124,"context_line":""},{"line_number":125,"context_line":"        obj \u003d base.CyborgObject._from_db_object(obj, db_obj)"},{"line_number":126,"context_line":"        return obj"}],"source_content_type":"text/x-python","patch_set":25,"id":"7faddb67_2b18ddca","line":123,"range":{"start_line":123,"start_character":8,"end_line":123,"end_character":42},"in_reply_to":"7faddb67_08464751","updated":"2019-09-05 14:09:47.000000000","message":"Done","commit_id":"65ae01925327d9b2f1be8ef836a3fbffc2c8ae1e"}],"cyborg/tests/unit/api/controllers/v2/test_device_profiles.py":[{"author":{"_account_id":25738,"name":"Xinran WANG","email":"xin-ran.wang@intel.com","username":"Xinran"},"change_message_id":"e4de034e16a4ad63592ad1f613aae1a5509cb389","unresolved":false,"context_lines":[{"line_number":54,"context_line":"        self.assertEqual(data, {u\u0027device_profiles\u0027: []})"},{"line_number":55,"context_line":""},{"line_number":56,"context_line":"    def _test_create(self):"},{"line_number":57,"context_line":"        dps \u003d get_device_profiles()"},{"line_number":58,"context_line":"        response \u003d self.post_json(self.DP_URL,"},{"line_number":59,"context_line":"                                  dps[0], headers\u003dself.headers)"},{"line_number":60,"context_line":"        self.assertEqual(http_client.CREATED, response.status_int)"}],"source_content_type":"text/x-python","patch_set":6,"id":"7faddb67_e1af8f27","line":57,"range":{"start_line":57,"start_character":14,"end_line":57,"end_character":33},"updated":"2019-07-31 14:20:39.000000000","message":"method not defined here.","commit_id":"819b99e0d53a188d17c382236dbc7ef72058c2fd"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"f00769e726568ecdb9b9f7ab463b032835e66ac4","unresolved":false,"context_lines":[{"line_number":54,"context_line":"        self.assertEqual(data, {u\u0027device_profiles\u0027: []})"},{"line_number":55,"context_line":""},{"line_number":56,"context_line":"    def _test_create(self):"},{"line_number":57,"context_line":"        dps \u003d get_device_profiles()"},{"line_number":58,"context_line":"        response \u003d self.post_json(self.DP_URL,"},{"line_number":59,"context_line":"                                  dps[0], headers\u003dself.headers)"},{"line_number":60,"context_line":"        self.assertEqual(http_client.CREATED, response.status_int)"}],"source_content_type":"text/x-python","patch_set":6,"id":"7faddb67_07f10d96","line":57,"range":{"start_line":57,"start_character":14,"end_line":57,"end_character":33},"in_reply_to":"7faddb67_e1af8f27","updated":"2019-08-28 06:24:13.000000000","message":"Fixed in a later version.","commit_id":"819b99e0d53a188d17c382236dbc7ef72058c2fd"}],"cyborg/tests/unit/objects/test_device_profile.py":[{"author":{"_account_id":20722,"name":"Yikun Jiang","email":"yikunkero@gmail.com","username":"yikunkero"},"change_message_id":"1f9c0c136d46c20ecd6646bb78efdace66c3c198","unresolved":false,"context_lines":[{"line_number":49,"context_line":"            self.assertEqual(self.fake_device_profile[\u0027name\u0027],"},{"line_number":50,"context_line":"                             obj_devprofs[0].name)"},{"line_number":51,"context_line":""},{"line_number":52,"context_line":"    # TODO Enable these tests"},{"line_number":53,"context_line":"    def test_create(self):"},{"line_number":54,"context_line":"        api_devprofs \u003d fake_device_profile.get_api_devprofs()"},{"line_number":55,"context_line":"        api_devprof \u003d api_devprofs[0]"}],"source_content_type":"text/x-python","patch_set":25,"id":"7faddb67_450d083c","line":52,"range":{"start_line":52,"start_character":0,"end_line":52,"end_character":29},"updated":"2019-09-05 11:50:25.000000000","message":"nit: need clean up","commit_id":"65ae01925327d9b2f1be8ef836a3fbffc2c8ae1e"},{"author":{"_account_id":21672,"name":"Sundar Nadathur","email":"sundar.nadathur@intel.com","username":"nsundar"},"change_message_id":"33c54082429a8217cfaeaca388676596a2890781","unresolved":false,"context_lines":[{"line_number":49,"context_line":"            self.assertEqual(self.fake_device_profile[\u0027name\u0027],"},{"line_number":50,"context_line":"                             obj_devprofs[0].name)"},{"line_number":51,"context_line":""},{"line_number":52,"context_line":"    # TODO Enable these tests"},{"line_number":53,"context_line":"    def test_create(self):"},{"line_number":54,"context_line":"        api_devprofs \u003d fake_device_profile.get_api_devprofs()"},{"line_number":55,"context_line":"        api_devprof \u003d api_devprofs[0]"}],"source_content_type":"text/x-python","patch_set":25,"id":"7faddb67_d1fe9a03","line":52,"range":{"start_line":52,"start_character":0,"end_line":52,"end_character":29},"in_reply_to":"7faddb67_450d083c","updated":"2019-09-05 14:09:47.000000000","message":"Done","commit_id":"65ae01925327d9b2f1be8ef836a3fbffc2c8ae1e"}]}
