)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":19159,"name":"Ifat Afek","email":"ifat.afek@nokia.com","username":"ifat_afek"},"change_message_id":"8ccc1c0d35d85a2bb9a267278ae5fe4b00c2bf1e","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     idan kinory \u003cidan.kinory@nokia.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2017-09-07 11:55:40 +0000"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"add aodh gnocchi threshold alarm"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Change-Id: I2e958cff870f658fe720432e3261fb3b295afc56"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"7f287b81_cc0bd227","line":7,"range":{"start_line":7,"start_character":0,"end_line":7,"end_character":32},"updated":"2017-09-07 13:12:55.000000000","message":"Please add the following line:\n\nImplements: blueprint aodh-support-more-alarm-types","commit_id":"dff963a75b9b9c39897106e22087151c76e2ee07"}],"vitrage/datasources/aodh/driver.py":[{"author":{"_account_id":19159,"name":"Ifat Afek","email":"ifat.afek@nokia.com","username":"ifat_afek"},"change_message_id":"8ccc1c0d35d85a2bb9a267278ae5fe4b00c2bf1e","unresolved":false,"context_lines":[{"line_number":58,"context_line":"        try:"},{"line_number":59,"context_line":"            aodh_alarms \u003d self.client.alarms.list()"},{"line_number":60,"context_line":"            return [self._convert_alarm(alarm) for alarm in"},{"line_number":61,"context_line":"                    aodh_alarms if alarm is None]"},{"line_number":62,"context_line":"        except Exception as e:"},{"line_number":63,"context_line":"            LOG.exception(\"Failed to get all alarms, Exception: %s\", e)"},{"line_number":64,"context_line":"        return []"}],"source_content_type":"text/x-python","patch_set":1,"id":"7f287b81_62b985ca","line":61,"range":{"start_line":61,"start_character":41,"end_line":61,"end_character":48},"updated":"2017-09-07 13:12:55.000000000","message":"is not None","commit_id":"dff963a75b9b9c39897106e22087151c76e2ee07"},{"author":{"_account_id":19159,"name":"Ifat Afek","email":"ifat.afek@nokia.com","username":"ifat_afek"},"change_message_id":"8ccc1c0d35d85a2bb9a267278ae5fe4b00c2bf1e","unresolved":false,"context_lines":[{"line_number":93,"context_line":"    def _convert_gnocchi_resources_threshold(cls, alarm):"},{"line_number":94,"context_line":"        res \u003d cls._convert_base_alarm_gnocchi(alarm)"},{"line_number":95,"context_line":"        res[AodhProps.STATE_TIMESTAMP] \u003d \\"},{"line_number":96,"context_line":"            alarm.get(\u0027detail\u0027, {}).get(\u0027state_timestamp\u0027)"},{"line_number":97,"context_line":"        res[AodhProps.RESOURCE_ID] \u003d \\"},{"line_number":98,"context_line":"            alarm.get(\u0027detail\u0027, {}).get(\u0027rule\u0027, {}).get(\u0027resource_id\u0027)"},{"line_number":99,"context_line":"        return res"}],"source_content_type":"text/x-python","patch_set":1,"id":"7f287b81_472e9b92","line":96,"range":{"start_line":96,"start_character":22,"end_line":96,"end_character":30},"updated":"2017-09-07 13:12:55.000000000","message":"Please add it to AodhProps","commit_id":"dff963a75b9b9c39897106e22087151c76e2ee07"},{"author":{"_account_id":19159,"name":"Ifat Afek","email":"ifat.afek@nokia.com","username":"ifat_afek"},"change_message_id":"8ccc1c0d35d85a2bb9a267278ae5fe4b00c2bf1e","unresolved":false,"context_lines":[{"line_number":93,"context_line":"    def _convert_gnocchi_resources_threshold(cls, alarm):"},{"line_number":94,"context_line":"        res \u003d cls._convert_base_alarm_gnocchi(alarm)"},{"line_number":95,"context_line":"        res[AodhProps.STATE_TIMESTAMP] \u003d \\"},{"line_number":96,"context_line":"            alarm.get(\u0027detail\u0027, {}).get(\u0027state_timestamp\u0027)"},{"line_number":97,"context_line":"        res[AodhProps.RESOURCE_ID] \u003d \\"},{"line_number":98,"context_line":"            alarm.get(\u0027detail\u0027, {}).get(\u0027rule\u0027, {}).get(\u0027resource_id\u0027)"},{"line_number":99,"context_line":"        return res"}],"source_content_type":"text/x-python","patch_set":1,"id":"7f287b81_c7396bd7","line":96,"range":{"start_line":96,"start_character":40,"end_line":96,"end_character":57},"updated":"2017-09-07 13:12:55.000000000","message":"Same here","commit_id":"dff963a75b9b9c39897106e22087151c76e2ee07"},{"author":{"_account_id":19159,"name":"Ifat Afek","email":"ifat.afek@nokia.com","username":"ifat_afek"},"change_message_id":"8ccc1c0d35d85a2bb9a267278ae5fe4b00c2bf1e","unresolved":false,"context_lines":[{"line_number":320,"context_line":"        try:"},{"line_number":321,"context_line":"            entity[AodhProps.STATE] \u003d event[AodhProps.DETAIL][AodhProps.STATE]"},{"line_number":322,"context_line":"        except Exception as e:"},{"line_number":323,"context_line":"            LOG.exception(\"Convert alarm state transition event - %s\", e)"},{"line_number":324,"context_line":"        try:"},{"line_number":325,"context_line":"            state \u003d event[AodhProps.DETAIL]  # type unicode"},{"line_number":326,"context_line":"            unicode_to_str \u003d state.encode(\"ascii\")"}],"source_content_type":"text/x-python","patch_set":1,"id":"7f287b81_e741073b","line":323,"range":{"start_line":323,"start_character":27,"end_line":323,"end_character":34},"updated":"2017-09-07 13:12:55.000000000","message":"Write \"Failed to convert ...\"","commit_id":"dff963a75b9b9c39897106e22087151c76e2ee07"},{"author":{"_account_id":19159,"name":"Ifat Afek","email":"ifat.afek@nokia.com","username":"ifat_afek"},"change_message_id":"8ccc1c0d35d85a2bb9a267278ae5fe4b00c2bf1e","unresolved":false,"context_lines":[{"line_number":327,"context_line":"            str_to_dict \u003d ast.literal_eval(unicode_to_str)"},{"line_number":328,"context_line":"            entity[AodhProps.STATE] \u003d str_to_dict[AodhProps.STATE]"},{"line_number":329,"context_line":"        except Exception as e:"},{"line_number":330,"context_line":"            LOG.exception(\"Convert alarm state transition event - %s\", e)"},{"line_number":331,"context_line":""},{"line_number":332,"context_line":"        return self._filter_and_cache_alarm(entity, old_alarm,"},{"line_number":333,"context_line":"                                            self._filter_get_change,"}],"source_content_type":"text/x-python","patch_set":1,"id":"7f287b81_87448348","line":330,"range":{"start_line":330,"start_character":27,"end_line":330,"end_character":34},"updated":"2017-09-07 13:12:55.000000000","message":"Same here","commit_id":"dff963a75b9b9c39897106e22087151c76e2ee07"},{"author":{"_account_id":19159,"name":"Ifat Afek","email":"ifat.afek@nokia.com","username":"ifat_afek"},"change_message_id":"ae8c3a5e18b410d2cd03e6ee61d8804f212f65f1","unresolved":false,"context_lines":[{"line_number":91,"context_line":"    @classmethod"},{"line_number":92,"context_line":"    def _convert_gnocchi_resources_threshold(cls, alarm):"},{"line_number":93,"context_line":"        res \u003d cls._convert_base_alarm_gnocchi(alarm)"},{"line_number":94,"context_line":"        if type(alarm) is not dict:"},{"line_number":95,"context_line":"            alarm \u003d alarm.to_dict()"},{"line_number":96,"context_line":"            res[AodhProps.STATE_TIMESTAMP] \u003d \\"},{"line_number":97,"context_line":"                alarm.get(AodhProps.STATE_TIMESTAMP)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f2577a7_c7ff7dff","line":94,"range":{"start_line":94,"start_character":8,"end_line":94,"end_character":35},"updated":"2017-09-12 20:18:45.000000000","message":"Can you please explain why sometimes the alarm is dict and sometimes it is not? I understand that the content is also different - sometimes you have \"detail\" and sometimes it is a flat structure. Please add a comment with examples to both options.\nAlso, it\u0027s nicer to put the \"positive\" section first - start with \"if type(alarm) is dict\" and then \"else\".","commit_id":"f7c727482d575120c609a86ae366a25862b78f62"},{"author":{"_account_id":19159,"name":"Ifat Afek","email":"ifat.afek@nokia.com","username":"ifat_afek"},"change_message_id":"ae8c3a5e18b410d2cd03e6ee61d8804f212f65f1","unresolved":false,"context_lines":[{"line_number":118,"context_line":""},{"line_number":119,"context_line":"    @staticmethod"},{"line_number":120,"context_line":"    def _convert_base_alarm_gnocchi(alarm):"},{"line_number":121,"context_line":"        if type(alarm) is not dict:"},{"line_number":122,"context_line":"            alarm \u003d alarm.to_dict()"},{"line_number":123,"context_line":"            res \u003d {"},{"line_number":124,"context_line":"                AodhProps.SEVERITY: alarm.get(AodhProps.SEVERITY),"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f2577a7_87573503","line":121,"range":{"start_line":121,"start_character":8,"end_line":121,"end_character":34},"updated":"2017-09-12 20:18:45.000000000","message":"Same two comments:\n1. Start with the \"if is dict\" section\n2. Add example\n\nAnd another comment:\n3. Some fields are the same in both sections (like severity, alarm_id). Please put them in a common place, before the if statement. And if the remaining code is too long, please split it to two methods (convert_base_dict_alarm_gnocchi and convert_base_non_dict_alarm_gnocchi)","commit_id":"f7c727482d575120c609a86ae366a25862b78f62"}]}
