'Delete solr collection/core and instance dir'

def delete_collection(self, name, core):

    api = SolrApi(SOLR_URL.get(), self.user, SECURITY_ENABLED.get())
    client = SolrClient(self.user)
    if core:
        raise PopupException(_('Cannot    remove    Solr    cores.'))
    if api.remove_collection(name):
        try:
            root_node = ('%s/%s' % (ZK_SOLR_CONFIG_NAMESPACE, name))
            with ZookeeperClient(hosts=client.get_zookeeper_host(), read_only=False) as zc:
                zc.delete_path(root_node)
        except Exception as e:
            api.add_collection(name)
            raise PopupException(_('Error    in    deleting    Solr    configurations.'), detail=e)
    else:
        raise PopupException(_('Could    not    remove    collection.    Check    error    logs    for    more    info.'))
