def get_solr_core_status(core='all'):
    """Get the status for the solr core as an XML document."""
    if core == 'all':
        core_query = ''
    else:
        core_query = '&core=%s' % core
    r = requests.get(
        'http://localhost:8983/solr/admin/cores?action=STATUS%s' % core_query)
    if r.status_code != 200:
        print "Problem getting the core status. Got status_code of %s. Check " \
              "the Solr logs for details." % r.status_code

    try:
        solr_config = lxml.etree.parse(StringIO.StringIO(r.content))
    except lxml.etree.XMLSyntaxError, e:
        raise SolrError("Invalid XML in schema:\n%s" % e.args[0])
Beispiel #2
0
def get_solr_core_status(core='all', url=settings.SOLR_HOST):
    """Get the status for the solr core as an XML document."""
    if core == 'all':
        core_query = ''
    else:
        core_query = '&core=%s' % core
    r = requests.get('%s/solr/admin/cores?action=STATUS%s' % (url, core_query))
    if r.status_code != 200:
        print("Problem getting the core status. Got status_code of %s. "
              "Check the Solr logs for details." % r.status_code)

    try:
        solr_config = lxml.etree.parse(StringIO.StringIO(r.content))
    except lxml.etree.XMLSyntaxError as e:
        raise SolrError("Invalid XML in schema:\n%s" % e.args[0])

    return solr_config