)]}'
{"monasca_setup/detection/plugins/mon.py":[{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"758195bfc02d5107c1f59845bd1beee8c746e8b8","unresolved":false,"context_lines":[{"line_number":214,"context_line":""},{"line_number":215,"context_line":"    def __init__(self, template_dir, overwrite\u003dTrue, args\u003dNone):"},{"line_number":216,"context_line":"        super(MonAPI, self).__init__(template_dir, overwrite, args)"},{"line_number":217,"context_line":"        self._helper \u003d None"},{"line_number":218,"context_line":""},{"line_number":219,"context_line":"    def _detect(self):"},{"line_number":220,"context_line":"        \"\"\"Detects if monasca-api runs in the system"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_3467e9eb","line":217,"range":{"start_line":217,"start_character":13,"end_line":217,"end_character":20},"updated":"2016-11-29 19:03:48.000000000","message":"Should this be _impl_helper?","commit_id":"fdf43cb8324185514a082e2ead51bd4ba9b96eb4"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"758195bfc02d5107c1f59845bd1beee8c746e8b8","unresolved":false,"context_lines":[{"line_number":238,"context_line":""},{"line_number":239,"context_line":"        api_process \u003d find_process_cmdline(\u0027monasca-api\u0027)"},{"line_number":240,"context_line":""},{"line_number":241,"context_line":"        process_found \u003d api_process is not None"},{"line_number":242,"context_line":"        impl_lang \u003d _get_impl_lang(api_process) if process_found else None"},{"line_number":243,"context_line":"        impl_helper \u003d init_helper() if impl_lang else None"},{"line_number":244,"context_line":"        config_read \u003d impl_helper.load_configuration() if impl_helper else None"},{"line_number":245,"context_line":"        api_port \u003d impl_helper.get_bound_port()"},{"line_number":246,"context_line":"        port_taken \u003d check_port() if api_port else None"},{"line_number":247,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_343e092a","line":244,"range":{"start_line":241,"start_character":0,"end_line":244,"end_character":79},"updated":"2016-11-29 19:03:48.000000000","message":"I wonder if the code wouldn\u0027t be easier to understand if you didn\u0027t separate the checking of stuff like process_found from the error messages. The way you have it structured, you have to keep putting in the if else\u0027s.\n\nFor example,\nif not api_process:\n   log.error(\u0027monasca-api process has not been found. %s\u0027\n                          % err_str)\n   return\n\nThen you know in the following code that api_process is set.\n\nMight be worth trying and see what you think","commit_id":"fdf43cb8324185514a082e2ead51bd4ba9b96eb4"},{"author":{"_account_id":16168,"name":"Tomasz Trębski","email":"kornicameister@gmail.com","username":"trebskit"},"change_message_id":"b0f4a1e4c98a9fa799dde21f8d43cc5c7949d913","unresolved":false,"context_lines":[{"line_number":238,"context_line":""},{"line_number":239,"context_line":"        api_process \u003d find_process_cmdline(\u0027monasca-api\u0027)"},{"line_number":240,"context_line":""},{"line_number":241,"context_line":"        process_found \u003d api_process is not None"},{"line_number":242,"context_line":"        impl_lang \u003d _get_impl_lang(api_process) if process_found else None"},{"line_number":243,"context_line":"        impl_helper \u003d init_helper() if impl_lang else None"},{"line_number":244,"context_line":"        config_read \u003d impl_helper.load_configuration() if impl_helper else None"},{"line_number":245,"context_line":"        api_port \u003d impl_helper.get_bound_port()"},{"line_number":246,"context_line":"        port_taken \u003d check_port() if api_port else None"},{"line_number":247,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_60eb49b1","line":244,"range":{"start_line":241,"start_character":0,"end_line":244,"end_character":79},"in_reply_to":"5a74a57a_343e092a","updated":"2016-11-30 05:27:29.000000000","message":"I\u0027ve been following pattern that was used for other checks some time ago. However there were about...3 checks similar to those above, so you might have a point. On the other hand I did not wanted to introduce more than one exit point spreaded in several places like for instance: process not found so we do exit and if found we do another test which if fails makes us to exit from this method once again several lines below. \n\nI will keep it as it right now, till we reach some consensus here. I think it would be nice if other people looked at this as well. Obviously there are two different (contradicting) ideas :)","commit_id":"fdf43cb8324185514a082e2ead51bd4ba9b96eb4"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"758195bfc02d5107c1f59845bd1beee8c746e8b8","unresolved":false,"context_lines":[{"line_number":242,"context_line":"        impl_lang \u003d _get_impl_lang(api_process) if process_found else None"},{"line_number":243,"context_line":"        impl_helper \u003d init_helper() if impl_lang else None"},{"line_number":244,"context_line":"        config_read \u003d impl_helper.load_configuration() if impl_helper else None"},{"line_number":245,"context_line":"        api_port \u003d impl_helper.get_bound_port()"},{"line_number":246,"context_line":"        port_taken \u003d check_port() if api_port else None"},{"line_number":247,"context_line":""},{"line_number":248,"context_line":"        self.available \u003d process_found and config_read and port_taken"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_7854fd20","line":245,"range":{"start_line":245,"start_character":19,"end_line":245,"end_character":30},"updated":"2016-11-29 19:03:48.000000000","message":"impl_helper is sometimes set to None two statements above","commit_id":"fdf43cb8324185514a082e2ead51bd4ba9b96eb4"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"758195bfc02d5107c1f59845bd1beee8c746e8b8","unresolved":false,"context_lines":[{"line_number":243,"context_line":"        impl_helper \u003d init_helper() if impl_lang else None"},{"line_number":244,"context_line":"        config_read \u003d impl_helper.load_configuration() if impl_helper else None"},{"line_number":245,"context_line":"        api_port \u003d impl_helper.get_bound_port()"},{"line_number":246,"context_line":"        port_taken \u003d check_port() if api_port else None"},{"line_number":247,"context_line":""},{"line_number":248,"context_line":"        self.available \u003d process_found and config_read and port_taken"},{"line_number":249,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_34128959","line":246,"range":{"start_line":246,"start_character":51,"end_line":246,"end_character":55},"updated":"2016-11-29 19:03:48.000000000","message":"check_port() returns booleans so False would be better here","commit_id":"fdf43cb8324185514a082e2ead51bd4ba9b96eb4"},{"author":{"_account_id":16168,"name":"Tomasz Trębski","email":"kornicameister@gmail.com","username":"trebskit"},"change_message_id":"b0f4a1e4c98a9fa799dde21f8d43cc5c7949d913","unresolved":false,"context_lines":[{"line_number":243,"context_line":"        impl_helper \u003d init_helper() if impl_lang else None"},{"line_number":244,"context_line":"        config_read \u003d impl_helper.load_configuration() if impl_helper else None"},{"line_number":245,"context_line":"        api_port \u003d impl_helper.get_bound_port()"},{"line_number":246,"context_line":"        port_taken \u003d check_port() if api_port else None"},{"line_number":247,"context_line":""},{"line_number":248,"context_line":"        self.available \u003d process_found and config_read and port_taken"},{"line_number":249,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_80d065f9","line":246,"range":{"start_line":246,"start_character":51,"end_line":246,"end_character":55},"in_reply_to":"5a74a57a_34128959","updated":"2016-11-30 05:27:29.000000000","message":"+1","commit_id":"fdf43cb8324185514a082e2ead51bd4ba9b96eb4"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"758195bfc02d5107c1f59845bd1beee8c746e8b8","unresolved":false,"context_lines":[{"line_number":256,"context_line":"                log.error(\u0027monasca-api configuration could not be read. %s\u0027"},{"line_number":257,"context_line":"                          % err_str)"},{"line_number":258,"context_line":"            elif not port_taken:"},{"line_number":259,"context_line":"                log.error(\u0027monasca-api did not connect to port %d. %s\u0027"},{"line_number":260,"context_line":"                          % (api_port, err_str))"},{"line_number":261,"context_line":"        else:"},{"line_number":262,"context_line":"            self._impl_helper \u003d impl_helper"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_f45571fa","line":259,"range":{"start_line":259,"start_character":39,"end_line":259,"end_character":54},"updated":"2016-11-29 19:03:48.000000000","message":"is not listening on","commit_id":"fdf43cb8324185514a082e2ead51bd4ba9b96eb4"},{"author":{"_account_id":16168,"name":"Tomasz Trębski","email":"kornicameister@gmail.com","username":"trebskit"},"change_message_id":"b0f4a1e4c98a9fa799dde21f8d43cc5c7949d913","unresolved":false,"context_lines":[{"line_number":256,"context_line":"                log.error(\u0027monasca-api configuration could not be read. %s\u0027"},{"line_number":257,"context_line":"                          % err_str)"},{"line_number":258,"context_line":"            elif not port_taken:"},{"line_number":259,"context_line":"                log.error(\u0027monasca-api did not connect to port %d. %s\u0027"},{"line_number":260,"context_line":"                          % (api_port, err_str))"},{"line_number":261,"context_line":"        else:"},{"line_number":262,"context_line":"            self._impl_helper \u003d impl_helper"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_a0cd615f","line":259,"range":{"start_line":259,"start_character":39,"end_line":259,"end_character":54},"in_reply_to":"5a74a57a_f45571fa","updated":"2016-11-30 05:27:29.000000000","message":"+1","commit_id":"fdf43cb8324185514a082e2ead51bd4ba9b96eb4"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"758195bfc02d5107c1f59845bd1beee8c746e8b8","unresolved":false,"context_lines":[{"line_number":260,"context_line":"                          % (api_port, err_str))"},{"line_number":261,"context_line":"        else:"},{"line_number":262,"context_line":"            self._impl_helper \u003d impl_helper"},{"line_number":263,"context_line":"            self._impl_lang \u003d impl_lang"},{"line_number":264,"context_line":""},{"line_number":265,"context_line":"    def build_config(self):"},{"line_number":266,"context_line":"        \"\"\"Build the config as a Plugins object and return.\"\"\""}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_54ab85d6","line":263,"range":{"start_line":263,"start_character":17,"end_line":263,"end_character":27},"updated":"2016-11-29 19:03:48.000000000","message":"Not used","commit_id":"fdf43cb8324185514a082e2ead51bd4ba9b96eb4"},{"author":{"_account_id":16168,"name":"Tomasz Trębski","email":"kornicameister@gmail.com","username":"trebskit"},"change_message_id":"b0f4a1e4c98a9fa799dde21f8d43cc5c7949d913","unresolved":false,"context_lines":[{"line_number":260,"context_line":"                          % (api_port, err_str))"},{"line_number":261,"context_line":"        else:"},{"line_number":262,"context_line":"            self._impl_helper \u003d impl_helper"},{"line_number":263,"context_line":"            self._impl_lang \u003d impl_lang"},{"line_number":264,"context_line":""},{"line_number":265,"context_line":"    def build_config(self):"},{"line_number":266,"context_line":"        \"\"\"Build the config as a Plugins object and return.\"\"\""}],"source_content_type":"text/x-python","patch_set":4,"id":"5a74a57a_20a5d1b4","line":263,"range":{"start_line":263,"start_character":17,"end_line":263,"end_character":27},"in_reply_to":"5a74a57a_54ab85d6","updated":"2016-11-30 05:27:29.000000000","message":"Yeah, I got different idea to keep with building config in the MonAPI class directly but later on I moved away from it. Little one was left behind.","commit_id":"fdf43cb8324185514a082e2ead51bd4ba9b96eb4"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"f0abb54625d0dec6daa14ec1a5246c32e0e7b912","unresolved":false,"context_lines":[{"line_number":471,"context_line":"            with open(self.CONFIG_FILE, \u0027r\u0027) as config:"},{"line_number":472,"context_line":"                self._cfg \u003d yaml.safe_load(config.read())"},{"line_number":473,"context_line":"        except Exception as ex:"},{"line_number":474,"context_line":"            log.error(\u0027Failed to parse %s\u0027, self.CONFIG_FILE)"},{"line_number":475,"context_line":"            log.exception(repr(ex))"},{"line_number":476,"context_line":""},{"line_number":477,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_2f6f59c6","line":474,"updated":"2016-12-13 18:42:44.000000000","message":"This needs to raise an exception so the rest of the configuration is aborted otherwise the first use of _cfg in the methods above will fail.","commit_id":"a7d67e56808257c5aeabc81a624100d41ba88209"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"f0abb54625d0dec6daa14ec1a5246c32e0e7b912","unresolved":false,"context_lines":[{"line_number":472,"context_line":"                self._cfg \u003d yaml.safe_load(config.read())"},{"line_number":473,"context_line":"        except Exception as ex:"},{"line_number":474,"context_line":"            log.error(\u0027Failed to parse %s\u0027, self.CONFIG_FILE)"},{"line_number":475,"context_line":"            log.exception(repr(ex))"},{"line_number":476,"context_line":""},{"line_number":477,"context_line":""},{"line_number":478,"context_line":"class _MonPersisterPythonHelper(object):"}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_af3529db","line":475,"range":{"start_line":475,"start_character":26,"end_line":475,"end_character":34},"updated":"2016-12-13 18:42:44.000000000","message":"I believe this should just be ex for a log.exception","commit_id":"a7d67e56808257c5aeabc81a624100d41ba88209"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"f0abb54625d0dec6daa14ec1a5246c32e0e7b912","unresolved":false,"context_lines":[{"line_number":481,"context_line":""},{"line_number":482,"context_line":"    def __init__(self):"},{"line_number":483,"context_line":"        super(_MonPersisterPythonHelper, self).__init__()"},{"line_number":484,"context_line":"        self._p_config \u003d None"},{"line_number":485,"context_line":""},{"line_number":486,"context_line":"    def build_config(self):"},{"line_number":487,"context_line":"        return None"}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_cf5ee511","line":484,"range":{"start_line":484,"start_character":8,"end_line":484,"end_character":29},"updated":"2016-12-13 18:42:44.000000000","message":"Is not used?","commit_id":"a7d67e56808257c5aeabc81a624100d41ba88209"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"f0abb54625d0dec6daa14ec1a5246c32e0e7b912","unresolved":false,"context_lines":[{"line_number":620,"context_line":"            with open(self.API_CONFIG_YML, \u0027r\u0027) as config:"},{"line_number":621,"context_line":"                self._api_config \u003d yaml.safe_load(config.read())"},{"line_number":622,"context_line":"        except Exception as ex:"},{"line_number":623,"context_line":"            log.error(\u0027Failed to parse /etc/monasca/api-config.yml\u0027)"},{"line_number":624,"context_line":"            log.exception(repr(ex))"},{"line_number":625,"context_line":""},{"line_number":626,"context_line":"    def get_bound_port(self):"},{"line_number":627,"context_line":"        \"\"\"Returns port API is listening on."}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_0f861d65","line":624,"range":{"start_line":623,"start_character":0,"end_line":624,"end_character":35},"updated":"2016-12-13 18:42:44.000000000","message":"See comments above in the persister java helper","commit_id":"a7d67e56808257c5aeabc81a624100d41ba88209"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"f0abb54625d0dec6daa14ec1a5246c32e0e7b912","unresolved":false,"context_lines":[{"line_number":697,"context_line":"            cp.readfp(open(self.API_PASTE_CONFIG, \u0027r\u0027))"},{"line_number":698,"context_line":"            self._paste_config \u003d cp"},{"line_number":699,"context_line":"        except Exception as ex:"},{"line_number":700,"context_line":"            log.error(\u0027Failed to parse %s\u0027 % self.API_PASTE_CONFIG)"},{"line_number":701,"context_line":"            log.exception(repr(ex))"},{"line_number":702,"context_line":""},{"line_number":703,"context_line":"    def get_bound_port(self):"},{"line_number":704,"context_line":"        \"\"\"Returns port API is listening on."}],"source_content_type":"text/x-python","patch_set":13,"id":"1a6eadb0_4ff735f5","line":701,"range":{"start_line":700,"start_character":0,"end_line":701,"end_character":35},"updated":"2016-12-13 18:42:44.000000000","message":"Same comments here","commit_id":"a7d67e56808257c5aeabc81a624100d41ba88209"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"fefaf3b6aaf0d0e8ebf6b4de5c1ae7bd5f40dfaa","unresolved":false,"context_lines":[{"line_number":622,"context_line":"        except Exception as ex:"},{"line_number":623,"context_line":"            log.error(\u0027Failed to read api port from \u0027"},{"line_number":624,"context_line":"                      \u0027/etc/monasca/api-config.yml\u0027)"},{"line_number":625,"context_line":"            log.exception(repr(ex))"},{"line_number":626,"context_line":"            return _DEFAULT_API_PORT"},{"line_number":627,"context_line":""},{"line_number":628,"context_line":""}],"source_content_type":"text/x-python","patch_set":15,"id":"1a6eadb0_dc5dc649","line":625,"range":{"start_line":625,"start_character":26,"end_line":625,"end_character":34},"updated":"2016-12-19 23:15:11.000000000","message":"Should not be using repr(ex)","commit_id":"41f5e113e68d534fdd59eeb46e6f635f0d35828a"}]}
