def __init__(self, path, keyfile): config = ConfigParser.ConfigParser() config.read(path) self.group = config.get('env', 'group') self.description = config.get('env', 'description') self.vip_address = config.get('env', 'vip_address') self.mysql_adm_user = config.get('env', 'master_mysql_user') self.mysql_repl_user = config.get('env', 'slave_mysql_user') self.master = config.get('env', 'master') self.replication = config.get('env', 'slave') cipher = Utils.parse_key_file(keyfile) self.master_node = EnvironmentNode( self.master, config.get('env', 'master_ssh_user'), cipher.decrypt(config.get('env', 'master_ssh_password')), config.get('env', 'master_ssh_port')) self.replication_node = EnvironmentNode( self.replication, config.get('env', 'slave_ssh_user'), cipher.decrypt(config.get('env', 'slave_ssh_password')), config.get('env', 'slave_ssh_port')) self.nodes = [] self.nodes.append(self.master_node) self.nodes.append(self.replication_node)
def physical_master_node(test_key_path, environment): node = Node( environment.group, environment.master, conftest.default_connection() ) return PhysicalNode( node.ip, node.port, node.mysql_user, node.mysql_password, Utils.parse_key_file(test_key_path) )
def test_open_new_connection_succeds(test_key_path): assert foxha.connection.Connection( 'localhost', 3306, '', 'root', '', Utils.parse_key_file(test_key_path) ).connect()
def utils(): return Utils()
def default_logger(): return Utils.logfile(output_log_path())
def default_connection(): return connection.from_config_file(Utils.parse_key_file(test_key_path()), test_connection_config_path())