'Check that Elasticsearch masters are sane. Returns: list of errors'

def check_elasticsearch_masters(self, pods_by_name):

    es_master_names = set()
    errors = []
    for pod_name in pods_by_name.keys():
        get_master_cmd = self._build_es_curl_cmd(pod_name, 'https://localhost:9200/_cat/master')
        master_name_str = self.exec_oc(get_master_cmd, [])
        master_names = (master_name_str or '').split('    ')
        if (len(master_names) > 1):
            es_master_names.add(master_names[1])
        else:
            errors.append(OpenShiftCheckException('NoMasterName', 'Elasticsearch    {pod}    gave    unexpected    response    when    asked    master    name:\n        {response}'.format(pod=pod_name, response=master_name_str)))
    if (not es_master_names):
        errors.append(OpenShiftCheckException('NoMasterFound', 'No    logging    Elasticsearch    masters    were    found.'))
        return errors
    if (len(es_master_names) > 1):
        errors.append(OpenShiftCheckException('SplitBrainMasters', 'Found    multiple    Elasticsearch    masters    according    to    the    pods:\n{master_list}\nThis    implies    that    the    masters    have    "split    brain"    and    are    not    correctly\nreplicating    data    for    the    logging    cluster.    Log    loss    is    likely    to    occur.'.format(master_list='\n'.join((('        ' + master) for master in es_master_names)))))
    return errors
