mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Merge pull request #41163 from onlyanegg/elasticsearch-pass_profile_to_index_exists
Elasticsearch - pass hosts and profile to index_exists()
This commit is contained in:
commit
5b10fc58ba
@ -201,7 +201,7 @@ def document_delete(index, doc_type, id, hosts=None, profile=None):
|
||||
'''
|
||||
es = _get_instance(hosts, profile)
|
||||
try:
|
||||
if not index_exists(index=index):
|
||||
if not index_exists(index=index, hosts=hosts, profile=profile):
|
||||
return True
|
||||
else:
|
||||
result = es.delete(index=index, doc_type=doc_type, id=id)
|
||||
@ -263,7 +263,7 @@ def index_create(index, body=None, hosts=None, profile=None):
|
||||
'''
|
||||
es = _get_instance(hosts, profile)
|
||||
try:
|
||||
if index_exists(index):
|
||||
if index_exists(index, hosts=hosts, profile=profile):
|
||||
return True
|
||||
else:
|
||||
result = es.indices.create(index=index, body=body) # TODO error handling
|
||||
@ -283,7 +283,7 @@ def index_delete(index, hosts=None, profile=None):
|
||||
'''
|
||||
es = _get_instance(hosts, profile)
|
||||
try:
|
||||
if not index_exists(index=index):
|
||||
if not index_exists(index=index, hosts=hosts, profile=profile):
|
||||
return True
|
||||
else:
|
||||
result = es.indices.delete(index=index)
|
||||
@ -330,7 +330,7 @@ def index_get(index, hosts=None, profile=None):
|
||||
es = _get_instance(hosts, profile)
|
||||
|
||||
try:
|
||||
if index_exists(index):
|
||||
if index_exists(index, hosts=hosts, profile=profile):
|
||||
ret = es.indices.get(index=index) # TODO error handling
|
||||
return ret
|
||||
except elasticsearch.exceptions.NotFoundError:
|
||||
|
Loading…
Reference in New Issue
Block a user