コード例 #1
0
ファイル: controller.py プロジェクト: ziq211/hue
    def delete_collection(self, name, core):
        """
    Delete solr collection/core and instance dir
    """
        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):
            # Delete instance directory.
            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:
                # Re-create collection so that we don't have an orphan config
                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.'
                  ))
コード例 #2
0
  def delete_collection(self, name, core):
    """
    Delete solr collection/core and instance dir
    """
    api = SolrApi(SOLR_URL.get(), self.user, SECURITY_ENABLED.get())
    if core:
      raise PopupException(_('Cannot remove Solr cores.'))

    if api.remove_collection(name):
      # Delete instance directory.
      try:
        root_node = '%s/%s' % (ZK_SOLR_CONFIG_NAMESPACE, name)
        with ZookeeperClient(hosts=get_solr_ensemble(), read_only=False) as zc:
          zc.delete_path(root_node)
      except Exception, e:
        # Re-create collection so that we don't have an orphan config
        api.add_collection(name)
        raise PopupException(_('Error in deleting Solr configurations.'), detail=e)
コード例 #3
0
  def delete_collection(self, name, core):
    """
    Delete solr collection/core and instance dir
    """
    api = SolrApi(SOLR_URL.get(), self.user, SECURITY_ENABLED.get())
    if core:
      raise PopupException(_('Cannot remove Solr cores.'))

    if api.remove_collection(name):
      # Delete instance directory.
      try:
        root_node = '%s/%s' % (ZK_SOLR_CONFIG_NAMESPACE, name)
        zc = ZookeeperClient(hosts=get_solr_ensemble(), read_only=False)
        zc.delete_path(root_node)
      except Exception, e:
        # Re-create collection so that we don't have an orphan config
        api.add_collection(name)
        raise PopupException(_('Error in deleting Solr configurations.'), detail=e)