| __copyright__ = "Copyright 2019, Mirantis Inc." |
| __license__ = "Apache 2.0" |
| # Trying to import MySQLdb |
| # MySQLdb import failed, try to import PyMySQL |
| pymysql.install_as_MySQLdb() |
| Confirm that a python mysql client is installed. |
| return bool(MySQLdb), 'No python mysql client installed.' if MySQLdb is None else '' |
| def check_state(name, retries=18, timeout=10): |
| Ensure that galera node in Operational state. |
| :param timeout: number of seconds to wait before retries |
| :param retries: number of retries |
| out = __salt__['mysql.status']() |
| if isinstance(out, dict) and out.get('wsrep_evs_state') == 'OPERATIONAL': |
| "comment": "Galera node is not in operational state : %s" % out['wsrep_evs_state']} |
| return {"result": True, "name": name, "changes": {}, "comment": "Galera node is in operational state : %s" % out['wsrep_evs_state']} |