def archive_connection(config): store = ESStore(config.datastore.hosts, archive_access=True) ret_val = store.ping() if not ret_val: pytest.skip("Could not connect to datastore") return AssemblylineDatastore(store)
def datastore_connection(): store = ESStore(config.datastore.hosts) ret_val = store.ping() if not ret_val: pytest.skip("Could not connect to datastore") return AssemblylineDatastore(store)
def es_store(): from assemblyline.datastore.stores.es_store import ESStore store = ESStore(['127.0.0.1']) ret_val = store.ping() if ret_val: return store return pytest.skip( "Connection to the Elasticsearch server failed. This test cannot be performed..." )
def get_datastore(config=None, archive_access=False): from assemblyline.datastore.helper import AssemblylineDatastore if not config: config = get_config(static=True) if config.datastore.type == "elasticsearch": from assemblyline.datastore.stores.es_store import ESStore if archive_access: return AssemblylineDatastore(ESStore(config.datastore.hosts, archive_access=True)) else: return AssemblylineDatastore(ESStore(config.datastore.hosts, archive_access=False)) else: from assemblyline.datastore.exceptions import DataStoreException raise DataStoreException(f"Invalid datastore type: {config.datastore.type}")
def es_connection(request): from assemblyline.datastore.stores.es_store import ESStore try: collection = setup_store(ESStore(['127.0.0.1']), request) except SetupException: collection = None if collection: return collection return pytest.skip("Connection to the Elasticsearch server failed. This test cannot be performed...")
def es_datastore(): try: document_store = setup_store(ESStore(['127.0.0.1'])) except SetupException: document_store = None if document_store: return document_store return pytest.skip( "Connection to the Elasticsearch server failed. This test cannot be performed..." )
def es_connection(model, use_model=True): from assemblyline.datastore.stores.es_store import ESStore return setup_collection(ESStore(['127.0.0.1']), model, use_model)