def do_index_command(self, index, **options):
     """Delete search index."""
     if options['interactive']:
         logger.warn("This will permanently delete the index '%s'.", index)
         if not self._confirm_action():
             logger.warn(
                 "Aborting deletion of index '%s' at user's request.",
                 index)
             return
     return delete_index(index)
    def do_index_command(self, index, **options):
        """Rebuild search index."""
        if options['interactive']:
            logger.warn("This will permanently delete the index '%s'.", index)
            if not self._confirm_action():
                logger.warn(
                    "Aborting rebuild of index '%s' at user's request.", index)
                return

        delete = delete_index(index)
        create = create_index(index)
        update = update_index(index)

        return {'delete': delete, 'create': create, 'update': update}
Ejemplo n.º 3
0
 def test_delete_index(self, mock_client):
     """Test the delete_index function."""
     delete_index("foo")
     mock_client.assert_called_once()
     mock_client.return_value.indices.delete.assert_called_once_with(
         index="foo")