)]}'
{"monasca_notification/plugins/jira_notifier.py":[{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"990fa61006b6eedce114ae973d191da33c99ce13","unresolved":false,"context_lines":[{"line_number":55,"context_line":""},{"line_number":56,"context_line":"    def _import_jira(self):"},{"line_number":57,"context_line":"        try:"},{"line_number":58,"context_line":"            module \u003d __import__(\"jira\")"},{"line_number":59,"context_line":"        except Exception as e:"},{"line_number":60,"context_line":"            self._log.exception(\"JIRA plugin requires JIRA module. Install JIRA using pip install jira\")"},{"line_number":61,"context_line":"            raise e"}],"source_content_type":"text/x-python","patch_set":3,"id":"bacf61ea_aada6f76","line":58,"range":{"start_line":58,"start_character":21,"end_line":58,"end_character":31},"updated":"2016-07-28 03:43:15.000000000","message":"This should be using importlib from the standard library.","commit_id":"b7caa5cc2f9a254dc1d41cfa8af2fd259fa1b549"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"990fa61006b6eedce114ae973d191da33c99ce13","unresolved":false,"context_lines":[{"line_number":106,"context_line":"        auth \u003d (self._config[\"username\"], self._config[\"password\"])"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"        try:"},{"line_number":109,"context_line":"            jira \u003d self._import_jira().JIRA(url, basic_auth\u003dauth)"},{"line_number":110,"context_line":""},{"line_number":111,"context_line":"            project_key \u003d query_params[\"project\"][0]"},{"line_number":112,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"bacf61ea_ea69078d","line":109,"range":{"start_line":109,"start_character":24,"end_line":109,"end_character":36},"updated":"2016-07-28 03:43:15.000000000","message":"This is far too late to determine that the plugin can\u0027t run.  If the system is running well this code may never execute.  We need to determine if the plugin is functional either when we attempt to load it or when we attempt to configure it.","commit_id":"b7caa5cc2f9a254dc1d41cfa8af2fd259fa1b549"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"3556e5534424f8b692136336a63c25c656e1352e","unresolved":false,"context_lines":[{"line_number":106,"context_line":"        auth \u003d (self._config[\"username\"], self._config[\"password\"])"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"        try:"},{"line_number":109,"context_line":"            jira \u003d self._import_jira().JIRA(url, basic_auth\u003dauth)"},{"line_number":110,"context_line":""},{"line_number":111,"context_line":"            project_key \u003d query_params[\"project\"][0]"},{"line_number":112,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"bacf61ea_579a5364","line":109,"range":{"start_line":109,"start_character":24,"end_line":109,"end_character":36},"in_reply_to":"bacf61ea_84b01e45","updated":"2016-07-28 16:24:41.000000000","message":"Imports are just globally bound symbols so if you successfully imported it in config assign it to a global variable and use that variable elsewhere the same as you would a normal import.  Alternatively you should be able to simply wrap a normal import in a try/except block, raise an expection on failure, and let the higher level code calling simport deal with the failure.","commit_id":"b7caa5cc2f9a254dc1d41cfa8af2fd259fa1b549"},{"author":{"_account_id":220,"name":"Haneef Ali","email":"haneef.ali@hp.com","username":"haneef"},"change_message_id":"ed744331dacb5519f8c365155b25d9591bb8faeb","unresolved":false,"context_lines":[{"line_number":106,"context_line":"        auth \u003d (self._config[\"username\"], self._config[\"password\"])"},{"line_number":107,"context_line":""},{"line_number":108,"context_line":"        try:"},{"line_number":109,"context_line":"            jira \u003d self._import_jira().JIRA(url, basic_auth\u003dauth)"},{"line_number":110,"context_line":""},{"line_number":111,"context_line":"            project_key \u003d query_params[\"project\"][0]"},{"line_number":112,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"bacf61ea_84b01e45","line":109,"range":{"start_line":109,"start_character":24,"end_line":109,"end_character":36},"in_reply_to":"bacf61ea_ea69078d","updated":"2016-07-28 15:25:01.000000000","message":"It is checked in config, so it is just getting the reference. I could have stored the result in the variable and used it. I will fix it","commit_id":"b7caa5cc2f9a254dc1d41cfa8af2fd259fa1b549"},{"author":{"_account_id":16168,"name":"Tomasz Trębski","email":"kornicameister@gmail.com","username":"trebskit"},"change_message_id":"675a5801d28ae833c8c43661f5fa42d34c6658a7","unresolved":false,"context_lines":[{"line_number":113,"context_line":"            issue_dict \u003d {\u0027project\u0027: {\u0027key\u0027: project_key},"},{"line_number":114,"context_line":"                          \u0027summary\u0027: \"Created by Monasca \" + notification.message,"},{"line_number":115,"context_line":"                          \u0027description\u0027: \u0027Monasca alaram\u0027,"},{"line_number":116,"context_line":"                          \u0027issuetype\u0027: {\u0027name\u0027: \u0027Bug\u0027}, }"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"            # If the JIRA workflow is created with mandatory components"},{"line_number":119,"context_line":"            if query_params.get(\"component\"):"}],"source_content_type":"text/x-python","patch_set":3,"id":"bacf61ea_8af32b0a","line":116,"updated":"2016-07-28 03:36:46.000000000","message":"Does it really need to be bug ? If alarms goes back to OK or UNDETERMINED it is not a bug ?","commit_id":"b7caa5cc2f9a254dc1d41cfa8af2fd259fa1b549"},{"author":{"_account_id":16168,"name":"Tomasz Trębski","email":"kornicameister@gmail.com","username":"trebskit"},"change_message_id":"05122e4e475d3911d4cb438a3916738246fe5424","unresolved":false,"context_lines":[{"line_number":113,"context_line":"            issue_dict \u003d {\u0027project\u0027: {\u0027key\u0027: project_key},"},{"line_number":114,"context_line":"                          \u0027summary\u0027: \"Created by Monasca \" + notification.message,"},{"line_number":115,"context_line":"                          \u0027description\u0027: \u0027Monasca alaram\u0027,"},{"line_number":116,"context_line":"                          \u0027issuetype\u0027: {\u0027name\u0027: \u0027Bug\u0027}, }"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"            # If the JIRA workflow is created with mandatory components"},{"line_number":119,"context_line":"            if query_params.get(\"component\"):"}],"source_content_type":"text/x-python","patch_set":3,"id":"bacf61ea_8f672be8","line":116,"in_reply_to":"bacf61ea_4442a611","updated":"2016-08-01 05:51:18.000000000","message":"I am not so sure if that\u0027s in the scope of monitoring product to automatically resolve reported issues. It\u0027d have to know how to find them in the firsts place, right ? That\u0027s tricky problem here.","commit_id":"b7caa5cc2f9a254dc1d41cfa8af2fd259fa1b549"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"3556e5534424f8b692136336a63c25c656e1352e","unresolved":false,"context_lines":[{"line_number":113,"context_line":"            issue_dict \u003d {\u0027project\u0027: {\u0027key\u0027: project_key},"},{"line_number":114,"context_line":"                          \u0027summary\u0027: \"Created by Monasca \" + notification.message,"},{"line_number":115,"context_line":"                          \u0027description\u0027: \u0027Monasca alaram\u0027,"},{"line_number":116,"context_line":"                          \u0027issuetype\u0027: {\u0027name\u0027: \u0027Bug\u0027}, }"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"            # If the JIRA workflow is created with mandatory components"},{"line_number":119,"context_line":"            if query_params.get(\"component\"):"}],"source_content_type":"text/x-python","patch_set":3,"id":"bacf61ea_37eb5fb2","line":116,"in_reply_to":"bacf61ea_4442a611","updated":"2016-07-28 16:24:41.000000000","message":"If the alarm definition is set up for it we will generate notifications on transition to Ok, Alarm, and Undetermined states.","commit_id":"b7caa5cc2f9a254dc1d41cfa8af2fd259fa1b549"},{"author":{"_account_id":220,"name":"Haneef Ali","email":"haneef.ali@hp.com","username":"haneef"},"change_message_id":"ed744331dacb5519f8c365155b25d9591bb8faeb","unresolved":false,"context_lines":[{"line_number":113,"context_line":"            issue_dict \u003d {\u0027project\u0027: {\u0027key\u0027: project_key},"},{"line_number":114,"context_line":"                          \u0027summary\u0027: \"Created by Monasca \" + notification.message,"},{"line_number":115,"context_line":"                          \u0027description\u0027: \u0027Monasca alaram\u0027,"},{"line_number":116,"context_line":"                          \u0027issuetype\u0027: {\u0027name\u0027: \u0027Bug\u0027}, }"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"            # If the JIRA workflow is created with mandatory components"},{"line_number":119,"context_line":"            if query_params.get(\"component\"):"}],"source_content_type":"text/x-python","patch_set":3,"id":"bacf61ea_4442a611","line":116,"in_reply_to":"bacf61ea_4a881323","updated":"2016-07-28 15:25:01.000000000","message":"This part I need to understand.  That\u0027s why I  opened up the review before it is done.\n\nWill monasca send a notification when it is resolved?\n If so we need an ability to open and close the issue automatically","commit_id":"b7caa5cc2f9a254dc1d41cfa8af2fd259fa1b549"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"a8ef2bc812f03d0b8845be5b27eca66f0df8b530","unresolved":false,"context_lines":[{"line_number":113,"context_line":"            issue_dict \u003d {\u0027project\u0027: {\u0027key\u0027: project_key},"},{"line_number":114,"context_line":"                          \u0027summary\u0027: \"Created by Monasca \" + notification.message,"},{"line_number":115,"context_line":"                          \u0027description\u0027: \u0027Monasca alaram\u0027,"},{"line_number":116,"context_line":"                          \u0027issuetype\u0027: {\u0027name\u0027: \u0027Bug\u0027}, }"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"            # If the JIRA workflow is created with mandatory components"},{"line_number":119,"context_line":"            if query_params.get(\"component\"):"}],"source_content_type":"text/x-python","patch_set":3,"id":"bacf61ea_4a881323","line":116,"in_reply_to":"bacf61ea_8af32b0a","updated":"2016-07-28 03:44:41.000000000","message":"That\u0027s a good question.  Even if it\u0027s not a bug how do we clean up issues that have been automatically resolved?","commit_id":"b7caa5cc2f9a254dc1d41cfa8af2fd259fa1b549"},{"author":{"_account_id":220,"name":"Haneef Ali","email":"haneef.ali@hp.com","username":"haneef"},"change_message_id":"378a055644084be822ec7499b0512ecf17448fb5","unresolved":false,"context_lines":[{"line_number":113,"context_line":"            issue_dict \u003d {\u0027project\u0027: {\u0027key\u0027: project_key},"},{"line_number":114,"context_line":"                          \u0027summary\u0027: \"Created by Monasca \" + notification.message,"},{"line_number":115,"context_line":"                          \u0027description\u0027: \u0027Monasca alaram\u0027,"},{"line_number":116,"context_line":"                          \u0027issuetype\u0027: {\u0027name\u0027: \u0027Bug\u0027}, }"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"            # If the JIRA workflow is created with mandatory components"},{"line_number":119,"context_line":"            if query_params.get(\"component\"):"}],"source_content_type":"text/x-python","patch_set":3,"id":"bacf61ea_ed68018a","line":116,"in_reply_to":"bacf61ea_8f672be8","updated":"2016-08-02 22:58:45.000000000","message":"I had some discussion with team, this is what we came up\n\n1) If the issue is already there for an alarm don\u0027t create it\n\n2) If the issue resolves automatically, then update the comments with current state.  Don\u0027t close it automatically.  So any one who is looking at the issue will get a picture of full lifecycle","commit_id":"b7caa5cc2f9a254dc1d41cfa8af2fd259fa1b549"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"990fa61006b6eedce114ae973d191da33c99ce13","unresolved":false,"context_lines":[{"line_number":123,"context_line":""},{"line_number":124,"context_line":"            new_issue \u003d jira.create_issue(fields\u003dissue_dict)"},{"line_number":125,"context_line":"            jira_message \u003d self._build_jira_message(notification)"},{"line_number":126,"context_line":"            formatted_json \u003d \"{code}%s{code}\" %(jira_message)"},{"line_number":127,"context_line":"            jira.add_comment(new_issue, formatted_json)"},{"line_number":128,"context_line":"        except Exception:"},{"line_number":129,"context_line":"            self._log.exception(\"Error creating issue in Jira at URL {}\".format(url))"}],"source_content_type":"text/x-python","patch_set":3,"id":"bacf61ea_4ad3f338","line":126,"range":{"start_line":126,"start_character":0,"end_line":126,"end_character":61},"updated":"2016-07-28 03:43:15.000000000","message":"Without seeing this actually run this seems to just dump the raw json into the jira ticket.  Isn\u0027t there something we could do with the formatting to make this more usable?","commit_id":"b7caa5cc2f9a254dc1d41cfa8af2fd259fa1b549"},{"author":{"_account_id":220,"name":"Haneef Ali","email":"haneef.ali@hp.com","username":"haneef"},"change_message_id":"ed744331dacb5519f8c365155b25d9591bb8faeb","unresolved":false,"context_lines":[{"line_number":123,"context_line":""},{"line_number":124,"context_line":"            new_issue \u003d jira.create_issue(fields\u003dissue_dict)"},{"line_number":125,"context_line":"            jira_message \u003d self._build_jira_message(notification)"},{"line_number":126,"context_line":"            formatted_json \u003d \"{code}%s{code}\" %(jira_message)"},{"line_number":127,"context_line":"            jira.add_comment(new_issue, formatted_json)"},{"line_number":128,"context_line":"        except Exception:"},{"line_number":129,"context_line":"            self._log.exception(\"Error creating issue in Jira at URL {}\".format(url))"}],"source_content_type":"text/x-python","patch_set":3,"id":"bacf61ea_84965e4a","line":126,"range":{"start_line":126,"start_character":0,"end_line":126,"end_character":61},"in_reply_to":"bacf61ea_4ad3f338","updated":"2016-07-28 15:25:01.000000000","message":"Yes. I\u0027m going to do that for all the plugins.  That is the second phase. My goal is to add a Jinja2 templating capability. So the customer can customize the template. My current thinking was\n\nevery plugin config will have\n   tempalte : /template location for that plugin\n\nif template is defined, take the result from the template, otherwise use the default format.\n\nAny other suggestion is welcome.","commit_id":"b7caa5cc2f9a254dc1d41cfa8af2fd259fa1b549"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"3556e5534424f8b692136336a63c25c656e1352e","unresolved":false,"context_lines":[{"line_number":123,"context_line":""},{"line_number":124,"context_line":"            new_issue \u003d jira.create_issue(fields\u003dissue_dict)"},{"line_number":125,"context_line":"            jira_message \u003d self._build_jira_message(notification)"},{"line_number":126,"context_line":"            formatted_json \u003d \"{code}%s{code}\" %(jira_message)"},{"line_number":127,"context_line":"            jira.add_comment(new_issue, formatted_json)"},{"line_number":128,"context_line":"        except Exception:"},{"line_number":129,"context_line":"            self._log.exception(\"Error creating issue in Jira at URL {}\".format(url))"}],"source_content_type":"text/x-python","patch_set":3,"id":"bacf61ea_97404ba7","line":126,"range":{"start_line":126,"start_character":0,"end_line":126,"end_character":61},"in_reply_to":"bacf61ea_84965e4a","updated":"2016-07-28 16:24:41.000000000","message":"Even for a first phase I\u0027d expect some kind of formatting here.  You\u0027re just dumping all the json into the call which could be hundreds or thousands of lines of data depending on how the alarm definition is set up.","commit_id":"b7caa5cc2f9a254dc1d41cfa8af2fd259fa1b549"},{"author":{"_account_id":16168,"name":"Tomasz Trębski","email":"kornicameister@gmail.com","username":"trebskit"},"change_message_id":"f43955da43eea533885d722b93242ed7e2a83570","unresolved":false,"context_lines":[{"line_number":55,"context_line":""},{"line_number":56,"context_line":"    def _import_jira(self):"},{"line_number":57,"context_line":"        try:"},{"line_number":58,"context_line":"            module \u003d __import__(\"jira\")"},{"line_number":59,"context_line":"        except Exception as e:"},{"line_number":60,"context_line":"            self._log.exception(\"JIRA plugin requires JIRA module. Install JIRA using pip install jira\")"},{"line_number":61,"context_line":"            raise e"}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_1e08f32c","line":58,"updated":"2016-08-16 08:23:13.000000000","message":"Having this written like this, we can easily move this to top-module code or follow up the agent approach (a.k.a. dependencies_installed mathod). So the rule\u0027d be to add static method \n\n @staticmethod\n def dependencies_installed():\n   return True/False\n\nand run it before instantiating the plugin just to see if that\u0027s actually possible ? \n\nWhat do you think about this ?","commit_id":"9c9ca702d89b2e12985c3a7dc2ee5fbee37b18af"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"2bc52c25dcc0851b3f0d913dbc0599478b7dc44e","unresolved":false,"context_lines":[{"line_number":55,"context_line":""},{"line_number":56,"context_line":"    def _import_jira(self):"},{"line_number":57,"context_line":"        try:"},{"line_number":58,"context_line":"            module \u003d __import__(\"jira\")"},{"line_number":59,"context_line":"        except Exception as e:"},{"line_number":60,"context_line":"            self._log.exception(\"JIRA plugin requires JIRA module. Install JIRA using pip install jira\")"},{"line_number":61,"context_line":"            raise e"}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_39d8571d","line":58,"in_reply_to":"3ac371cc_1e08f32c","updated":"2016-08-16 13:45:11.000000000","message":"I\u0027d prefer moving it to the top of the module.  The method the agent uses seems to cause issues with flake8 validation.  At some point I\u0027d like to fix that so we can properly detect unused imports.","commit_id":"9c9ca702d89b2e12985c3a7dc2ee5fbee37b18af"},{"author":{"_account_id":220,"name":"Haneef Ali","email":"haneef.ali@hp.com","username":"haneef"},"change_message_id":"f374f02c7d9cb148120c7ee7375e5300ca416580","unresolved":false,"context_lines":[{"line_number":55,"context_line":""},{"line_number":56,"context_line":"    def _import_jira(self):"},{"line_number":57,"context_line":"        try:"},{"line_number":58,"context_line":"            module \u003d __import__(\"jira\")"},{"line_number":59,"context_line":"        except Exception as e:"},{"line_number":60,"context_line":"            self._log.exception(\"JIRA plugin requires JIRA module. Install JIRA using pip install jira\")"},{"line_number":61,"context_line":"            raise e"}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_4230b09e","line":58,"in_reply_to":"3ac371cc_39d8571d","updated":"2016-08-16 16:46:15.000000000","message":"Agree, will incorporate the feedback","commit_id":"9c9ca702d89b2e12985c3a7dc2ee5fbee37b18af"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"1d6e05c885bef7a7c7de99d24af870be999f7241","unresolved":false,"context_lines":[{"line_number":55,"context_line":"            module \u003d __import__(\"jira\")"},{"line_number":56,"context_line":"        except Exception:"},{"line_number":57,"context_line":"            return None"},{"line_number":58,"context_line":"        return module"},{"line_number":59,"context_line":""},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"class JiraNotifier(AbstractNotifier):"}],"source_content_type":"text/x-python","patch_set":11,"id":"9a89bdaa_4fe53dda","line":58,"updated":"2016-09-06 22:22:59.000000000","message":"Indentation is not correct.\n\nAlso, I was wondering why you needed to defer this import. When the module is dynamically loaded if jira is not installed, wouldn\u0027t that be cause by the loader and the exception handled.\n\nAlso, I was wondering why only jira. Why not jinja2 too? Is jinga2 guaranteed to be installed?\n\nAlso, I think you should just log and re-raise the exception and not return None.","commit_id":"b8d510fd2db7319ea294b46ed6f5fc42e18c08ce"},{"author":{"_account_id":14273,"name":"Joe Keen","email":"joe.keen@hpe.com","username":"jkeen"},"change_message_id":"8e78b62871b0bc2bf347b069eafd6c90c3348583","unresolved":false,"context_lines":[{"line_number":55,"context_line":"            module \u003d __import__(\"jira\")"},{"line_number":56,"context_line":"        except Exception:"},{"line_number":57,"context_line":"            return None"},{"line_number":58,"context_line":"        return module"},{"line_number":59,"context_line":""},{"line_number":60,"context_line":""},{"line_number":61,"context_line":"class JiraNotifier(AbstractNotifier):"}],"source_content_type":"text/x-python","patch_set":11,"id":"9a89bdaa_780c853b","line":58,"in_reply_to":"9a89bdaa_4fe53dda","updated":"2016-09-06 22:43:24.000000000","message":"I think just importing jira and jinja2 would be fine.  The higher level code that uses simport to construct this object should deal with the failure.","commit_id":"b8d510fd2db7319ea294b46ed6f5fc42e18c08ce"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"1d6e05c885bef7a7c7de99d24af870be999f7241","unresolved":false,"context_lines":[{"line_number":69,"context_line":"        self._config \u003d {\u0027timeout\u0027: 5}"},{"line_number":70,"context_line":"        if not config_dict.get(\"user\") and not config_dict.get(\"password\"):"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"            message \u003d \"Missing user and password settings in JIRA plugin configuration\""},{"line_number":73,"context_line":"            self._log.exception(message)"},{"line_number":74,"context_line":"            raise Exception(message)"},{"line_number":75,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"9a89bdaa_2f32b95f","line":72,"updated":"2016-09-06 22:22:59.000000000","message":"I don\u0027t think we need a newline here?","commit_id":"b8d510fd2db7319ea294b46ed6f5fc42e18c08ce"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"1d6e05c885bef7a7c7de99d24af870be999f7241","unresolved":false,"context_lines":[{"line_number":70,"context_line":"        if not config_dict.get(\"user\") and not config_dict.get(\"password\"):"},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"            message \u003d \"Missing user and password settings in JIRA plugin configuration\""},{"line_number":73,"context_line":"            self._log.exception(message)"},{"line_number":74,"context_line":"            raise Exception(message)"},{"line_number":75,"context_line":""},{"line_number":76,"context_line":"        self._config.update(config_dict)"}],"source_content_type":"text/x-python","patch_set":11,"id":"9a89bdaa_6f0f6188","line":73,"updated":"2016-09-06 22:22:59.000000000","message":"Shouldn\u0027t this be _log.error? There isn\u0027t an exception being raised/thrown at this point. You have an error condition that you test for, so an error message should be logged. I believe exception should be used in only an exception handler block.","commit_id":"b8d510fd2db7319ea294b46ed6f5fc42e18c08ce"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"1d6e05c885bef7a7c7de99d24af870be999f7241","unresolved":false,"context_lines":[{"line_number":75,"context_line":""},{"line_number":76,"context_line":"        self._config.update(config_dict)"},{"line_number":77,"context_line":"        self._jira \u003d _import_jira()"},{"line_number":78,"context_line":"        if not self._jira:"},{"line_number":79,"context_line":"            message \u003d \"JIRA plugin requires JIRA module. Install JIRA using pip install jira\""},{"line_number":80,"context_line":"            self._log.exception(message)"},{"line_number":81,"context_line":"            raise Exception(message)"}],"source_content_type":"text/x-python","patch_set":11,"id":"9a89bdaa_2ff55956","line":78,"updated":"2016-09-06 22:22:59.000000000","message":"Assuming you keep the function _import_jira(), seems like you should not return None, and then just left the exception be propagated up the call stack, rather than catch the exception on import in _import_jira, return None, then test for None here and then raise another Exception.","commit_id":"b8d510fd2db7319ea294b46ed6f5fc42e18c08ce"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"1d6e05c885bef7a7c7de99d24af870be999f7241","unresolved":false,"context_lines":[{"line_number":86,"context_line":""},{"line_number":87,"context_line":"    @property"},{"line_number":88,"context_line":"    def statsd_name(self):"},{"line_number":89,"context_line":"        return \u0027jira_issue_creator\u0027"},{"line_number":90,"context_line":""},{"line_number":91,"context_line":"    def _build_custom_jira_message(self, notification):"},{"line_number":92,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"9a89bdaa_4fb45d81","line":89,"updated":"2016-09-06 22:22:59.000000000","message":"Seems like an obscure name for the statsd metric. Something like jira_notifier would match the class name closer.\n\nIs there another prefix on the metric?","commit_id":"b8d510fd2db7319ea294b46ed6f5fc42e18c08ce"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"1d6e05c885bef7a7c7de99d24af870be999f7241","unresolved":false,"context_lines":[{"line_number":91,"context_line":"    def _build_custom_jira_message(self, notification):"},{"line_number":92,"context_line":""},{"line_number":93,"context_line":"        with open(self._config.get(\"custom_formatter\")) as f:"},{"line_number":94,"context_line":"            jira_fields_format \u003d yaml.load(f)"},{"line_number":95,"context_line":""},{"line_number":96,"context_line":"        # Remove the top element"},{"line_number":97,"context_line":"        jira_fields_format \u003d jira_fields_format[\"jira_format\"]"}],"source_content_type":"text/x-python","patch_set":11,"id":"9a89bdaa_550dcce6","line":94,"updated":"2016-09-06 22:22:59.000000000","message":"Is jira_fields_format a variable that could be initialized once when the plugin is loaded?","commit_id":"b8d510fd2db7319ea294b46ed6f5fc42e18c08ce"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"1d6e05c885bef7a7c7de99d24af870be999f7241","unresolved":false,"context_lines":[{"line_number":175,"context_line":""},{"line_number":176,"context_line":"    def jira_workflow(self, jira_fields, jira, notification):"},{"line_number":177,"context_line":"        \"\"\"How does Jira plugin work?"},{"line_number":178,"context_line":"           1) Check whether the issue with same description exists?"},{"line_number":179,"context_line":"           2) If issue exists, and if it is closed state, open it"},{"line_number":180,"context_line":"           3) if the issue doesn\u0027t exist, then create the issue"},{"line_number":181,"context_line":"           4) Add current alarm details in comments"}],"source_content_type":"text/x-python","patch_set":11,"id":"9a89bdaa_750c903b","line":178,"updated":"2016-09-06 22:22:59.000000000","message":"How is the description uniquely determined? Does the description contain the alarm ID?","commit_id":"b8d510fd2db7319ea294b46ed6f5fc42e18c08ce"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"1d6e05c885bef7a7c7de99d24af870be999f7241","unresolved":false,"context_lines":[{"line_number":176,"context_line":"    def jira_workflow(self, jira_fields, jira, notification):"},{"line_number":177,"context_line":"        \"\"\"How does Jira plugin work?"},{"line_number":178,"context_line":"           1) Check whether the issue with same description exists?"},{"line_number":179,"context_line":"           2) If issue exists, and if it is closed state, open it"},{"line_number":180,"context_line":"           3) if the issue doesn\u0027t exist, then create the issue"},{"line_number":181,"context_line":"           4) Add current alarm details in comments"},{"line_number":182,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":11,"id":"9a89bdaa_ef01b107","line":179,"updated":"2016-09-06 22:22:59.000000000","message":"I\u0027ve left some questions in the blueprint, but I didn\u0027t think a ticket would be re-opened if it was in the closed/resolved state.","commit_id":"b8d510fd2db7319ea294b46ed6f5fc42e18c08ce"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"1d6e05c885bef7a7c7de99d24af870be999f7241","unresolved":false,"context_lines":[{"line_number":192,"context_line":""},{"line_number":193,"context_line":"        search_term \u003d self._search_query.format(issue_dict[\"project\"][\"key\"],"},{"line_number":194,"context_line":"                                                self._config[\"user\"], notification.alarm_name)"},{"line_number":195,"context_line":"        issue_list \u003d jira.search_issues(search_term)"},{"line_number":196,"context_line":"        if not issue_list:"},{"line_number":197,"context_line":"            self._log.debug(\"Creating an issue with the data {}\".format(issue_dict))"},{"line_number":198,"context_line":"            issue \u003d jira.create_issue(fields\u003dissue_dict)"}],"source_content_type":"text/x-python","patch_set":11,"id":"9a89bdaa_557a2c78","line":195,"updated":"2016-09-06 22:22:59.000000000","message":"If a JIRA ticket doesn\u0027t exist, it looks like the ticket is potentiallty created even if the alarm is in the OK state. For example, the alarm is created in the UNDETERMINED state and then transitions to the OK state, it looks like a ticket is created. Is that correct? That could result in lot of alarms.","commit_id":"b8d510fd2db7319ea294b46ed6f5fc42e18c08ce"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"1d6e05c885bef7a7c7de99d24af870be999f7241","unresolved":false,"context_lines":[{"line_number":202,"context_line":"            current_state \u003d issue.fields.status.name"},{"line_number":203,"context_line":"            if current_state.lower() in [\"resolved\", \"closed\"]:"},{"line_number":204,"context_line":"                # Open the the issue"},{"line_number":205,"context_line":"                transitions \u003d jira.transitions(issue)"},{"line_number":206,"context_line":"                allowed_transistions \u003d [(t[\u0027id\u0027], t[\u0027name\u0027]) for t in transitions if \"reopen\" in t[\u0027name\u0027].lower()]"},{"line_number":207,"context_line":"                if allowed_transistions:"},{"line_number":208,"context_line":"                    # Reopen the issue"}],"source_content_type":"text/x-python","patch_set":11,"id":"9a89bdaa_3565a8b4","line":205,"updated":"2016-09-06 22:22:59.000000000","message":"Do you open the issue again, even if the notification is for the OK or UNDETERMINED state?","commit_id":"b8d510fd2db7319ea294b46ed6f5fc42e18c08ce"}]}
