Skip to content

Commit 3442cfa

Browse files
committed
make index_prefix for RemoteWorkspace configurable (thanks @Rizziepit)
1 parent a7e094f commit 3442cfa

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

elasticgit/workspace.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -336,22 +336,25 @@ class RemoteWorkspace(Workspace):
336336
337337
This is a read only version of the :py:class:`Workspace`
338338
"""
339-
def __init__(self, url, es=None):
339+
def __init__(self, url, es=None, index_prefix=None):
340340
"""
341341
:param str url:
342342
The URL of the unicore.distribute server.
343-
:param es dict:
343+
:param dict es:
344344
The parameters for connecting to Elasticsearch to. If not specified
345345
then the default unicore.distribute ES proxy would be used.
346346
This defaults to ``/esapi`` on the host of the ``url`` parameter
347347
provided.
348+
:param str index_prefix:
349+
The prefix to use when generating index names for Elasticsearch
348350
"""
349351
self.es_settings = es or {'urls': urljoin(url, '/esapi')}
352+
self.index_prefix = index_prefix or self.sm.repo_name
350353
self.sm = RemoteStorageManager(url)
351354
self.im = ESManager(
352355
self.sm,
353356
es=get_es(**self.es_settings),
354-
index_prefix=self.sm.repo_name)
357+
index_prefix=self.index_prefix)
355358

356359
def pull(self, branch_name='master', remote_name='origin'):
357360
# TOOD: In the local storage we're diffing the changes pulled in
@@ -416,6 +419,5 @@ def init_repo(cls, workdir, bare=False):
416419
def clone_repo(cls, repo_url, workdir):
417420
return Repo.clone_from(repo_url, workdir)
418421

419-
420422
Q
421423
F

0 commit comments

Comments
 (0)