Skip to content

Commit

Permalink
Merge pull request saltstack#39714 from alex-zel/patch-1
Browse files Browse the repository at this point in the history
Update elasticsearch.py
  • Loading branch information
Mike Place authored Feb 28, 2017
2 parents 13c720a + c423199 commit e6d6de6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions salt/modules/elasticsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ def _get_instance(hosts=None, profile=None):
use_ssl = _profile.get('use_ssl', False)
ca_certs = _profile.get('ca_certs', False)
verify_certs = _profile.get('verify_certs', False)
username = _profile.get('username', None)
password = _profile.get('password', None)

if not hosts:
hosts = ['127.0.0.1:9200']
Expand All @@ -114,6 +116,14 @@ def _get_instance(hosts=None, profile=None):
ca_certs=ca_certs,
verify_certs=verify_certs,
)
elif username and password:
es = elasticsearch.Elasticsearch(
hosts,
use_ssl=use_ssl,
ca_certs=ca_certs,
verify_certs=verify_certs,
http_auth=(username, password)
)
else:
# Custom connection class to use requests module with proxies
class ProxyConnection(RequestsHttpConnection):
Expand Down

0 comments on commit e6d6de6

Please sign in to comment.