)]}'
{"monasca_setup/detection/plugins/mysql.py":[{"author":{"_account_id":20873,"name":"Laszlo Hegedus","email":"hegedues.laszlo@gmail.com","username":"laszloh"},"change_message_id":"b331bb4e9e7370235cfeda441b9f776eaa8e30ce","unresolved":false,"context_lines":[{"line_number":110,"context_line":"        # First watch the process"},{"line_number":111,"context_line":"        config.merge(monasca_setup.detection.watch_process([\u0027mysqld\u0027], \u0027mysql\u0027))"},{"line_number":112,"context_line":"        log.info(\"\\tWatching the mysqld process.\")"},{"line_number":113,"context_line":"        import pymysql"},{"line_number":114,"context_line":"        try:"},{"line_number":115,"context_line":"            self._get_config()"},{"line_number":116,"context_line":"            # connection test"}],"source_content_type":"text/x-python","patch_set":1,"id":"9abb7d3a_f801ae6b","line":113,"range":{"start_line":113,"start_character":8,"end_line":113,"end_character":22},"updated":"2016-05-30 13:24:04.000000000","message":"Is there a reason why you moved it outside the try block? Maybe I have missed something.\n\nI think we could put it into the try block before self._get_config()","commit_id":"97b85b72552c52357b4e03b163c67423dce2a762"},{"author":{"_account_id":20033,"name":"Artur Basiak","email":"artur.basiak@ts.fujitsu.com","username":"abasiak"},"change_message_id":"0db0f712e7e17a41417af30a9467ede458dec11a","unresolved":false,"context_lines":[{"line_number":110,"context_line":"        # First watch the process"},{"line_number":111,"context_line":"        config.merge(monasca_setup.detection.watch_process([\u0027mysqld\u0027], \u0027mysql\u0027))"},{"line_number":112,"context_line":"        log.info(\"\\tWatching the mysqld process.\")"},{"line_number":113,"context_line":"        import pymysql"},{"line_number":114,"context_line":"        try:"},{"line_number":115,"context_line":"            self._get_config()"},{"line_number":116,"context_line":"            # connection test"}],"source_content_type":"text/x-python","patch_set":1,"id":"9abb7d3a_4a61e538","line":113,"range":{"start_line":113,"start_character":8,"end_line":113,"end_character":22},"in_reply_to":"9abb7d3a_f801ae6b","updated":"2016-05-31 06:16:35.000000000","message":"Thanks. This is a better idea. I moved it outside because python raise an error:\nUnboundLocalError: local variable \u0027pymysql\u0027 referenced before assignment\nBut with importing pymysql before self._get_config() everything works fine.","commit_id":"97b85b72552c52357b4e03b163c67423dce2a762"},{"author":{"_account_id":20873,"name":"Laszlo Hegedus","email":"hegedues.laszlo@gmail.com","username":"laszloh"},"change_message_id":"cac4c63e706db608d784817df5079556177f6dc0","unresolved":false,"context_lines":[{"line_number":116,"context_line":"            self._get_config()"},{"line_number":117,"context_line":"            # connection test"},{"line_number":118,"context_line":"            pymysql.connect(host\u003dself.host, user\u003dself.user, passwd\u003dself.password,"},{"line_number":119,"context_line":"                            port\u003dself.port, unix_socket\u003dself.socket, ssl\u003dself.ssl_options)"},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"            log.info(\"\\tConnection test success.\")"},{"line_number":122,"context_line":"            config[\u0027mysql\u0027] \u003d {"}],"source_content_type":"text/x-python","patch_set":2,"id":"9abb7d3a_6f6f6d2b","line":119,"range":{"start_line":119,"start_character":28,"end_line":119,"end_character":42},"updated":"2016-05-31 18:20:38.000000000","message":"I got an exception from pymysql that it expects an int here, but self.port is a string.\n\nI don\u0027t know if it only happened to me, but here\u0027s the guilty line in pymysql\u0027s code:\n\nhttps://github.com/PyMySQL/PyMySQL/blob/master/pymysql/connections.py#L896\n\nSo, I think we could change this assignment to port\u003dint(self.port) to avoid this issue.","commit_id":"15bb368d137b3983eb79941e94202d281a827ef5"},{"author":{"_account_id":12133,"name":"Cindy O\u0027Neill","email":"cindy.o-neill@hpe.com","username":"oneilcin"},"change_message_id":"f7ef3d5f2e26fe3059d8fe2fa19e487570ea6ee2","unresolved":false,"context_lines":[{"line_number":116,"context_line":"            self._get_config()"},{"line_number":117,"context_line":"            # connection test"},{"line_number":118,"context_line":"            pymysql.connect(host\u003dself.host, user\u003dself.user, passwd\u003dself.password,"},{"line_number":119,"context_line":"                            port\u003dself.port, unix_socket\u003dself.socket, ssl\u003dself.ssl_options)"},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"            log.info(\"\\tConnection test success.\")"},{"line_number":122,"context_line":"            config[\u0027mysql\u0027] \u003d {"}],"source_content_type":"text/x-python","patch_set":2,"id":"9abb7d3a_1a953886","line":119,"range":{"start_line":119,"start_character":28,"end_line":119,"end_character":42},"in_reply_to":"9abb7d3a_3a3c7cc7","updated":"2016-05-31 20:12:54.000000000","message":"That could be!  Good find I think the change is a good idea!","commit_id":"15bb368d137b3983eb79941e94202d281a827ef5"},{"author":{"_account_id":12133,"name":"Cindy O\u0027Neill","email":"cindy.o-neill@hpe.com","username":"oneilcin"},"change_message_id":"ee35a3cc9a017da0e2399eecae685c04123991c1","unresolved":false,"context_lines":[{"line_number":116,"context_line":"            self._get_config()"},{"line_number":117,"context_line":"            # connection test"},{"line_number":118,"context_line":"            pymysql.connect(host\u003dself.host, user\u003dself.user, passwd\u003dself.password,"},{"line_number":119,"context_line":"                            port\u003dself.port, unix_socket\u003dself.socket, ssl\u003dself.ssl_options)"},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"            log.info(\"\\tConnection test success.\")"},{"line_number":122,"context_line":"            config[\u0027mysql\u0027] \u003d {"}],"source_content_type":"text/x-python","patch_set":2,"id":"9abb7d3a_75dd7cdf","line":119,"range":{"start_line":119,"start_character":28,"end_line":119,"end_character":42},"in_reply_to":"9abb7d3a_6f6f6d2b","updated":"2016-05-31 19:57:17.000000000","message":"This didn\u0027t happen to me, but we are using the default port. I tried passing port\u003d3306 as an argument and as a line in the default file and it worked.  It might not hurt to add the int conversion since the library does expect an int - not sure why I didn\u0027t get the exception.","commit_id":"15bb368d137b3983eb79941e94202d281a827ef5"},{"author":{"_account_id":20873,"name":"Laszlo Hegedus","email":"hegedues.laszlo@gmail.com","username":"laszloh"},"change_message_id":"b50eb962922a141c19ce22019ababa1c0284cea1","unresolved":false,"context_lines":[{"line_number":116,"context_line":"            self._get_config()"},{"line_number":117,"context_line":"            # connection test"},{"line_number":118,"context_line":"            pymysql.connect(host\u003dself.host, user\u003dself.user, passwd\u003dself.password,"},{"line_number":119,"context_line":"                            port\u003dself.port, unix_socket\u003dself.socket, ssl\u003dself.ssl_options)"},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"            log.info(\"\\tConnection test success.\")"},{"line_number":122,"context_line":"            config[\u0027mysql\u0027] \u003d {"}],"source_content_type":"text/x-python","patch_set":2,"id":"9abb7d3a_3a3c7cc7","line":119,"range":{"start_line":119,"start_character":28,"end_line":119,"end_character":42},"in_reply_to":"9abb7d3a_75dd7cdf","updated":"2016-05-31 20:09:58.000000000","message":"It happened to me when I had it set in my.cnf.\nMaybe I was using a different version of pymysql.","commit_id":"15bb368d137b3983eb79941e94202d281a827ef5"},{"author":{"_account_id":12133,"name":"Cindy O\u0027Neill","email":"cindy.o-neill@hpe.com","username":"oneilcin"},"change_message_id":"3319fc6c8739e6e990aae8aefed5d8eb0da9d0e4","unresolved":false,"context_lines":[{"line_number":125,"context_line":"                  \u0027user\u0027: self.user, \u0027pass\u0027: self.password,"},{"line_number":126,"context_line":"                  \u0027sock\u0027: self.socket, \u0027ssl_ca\u0027: self.ssl_ca,"},{"line_number":127,"context_line":"                  \u0027ssl_key\u0027: self.ssl_key, \u0027ssl_cert\u0027: self.ssl_cert}]}"},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"        except pymysql.MySQLError as e:"},{"line_number":130,"context_line":"            exception_msg \u003d \u0027Could not connect to mysql. {}\u0027.format(e)"},{"line_number":131,"context_line":"            log.exception(exception_msg)"}],"source_content_type":"text/x-python","patch_set":2,"id":"9abb7d3a_6ab2bb95","line":128,"updated":"2016-05-31 18:40:26.000000000","message":"I tested, and if pymysql is not installed we still get an UnboundLocalError because we are catching the pymysql.MySQLError before an ImportError is caught.  So please add except ImportError here.  Using the format of logging the exception (indicating the pymsql library was not installed) and raising as done below.  Thanks!","commit_id":"15bb368d137b3983eb79941e94202d281a827ef5"}]}
