Skip to content

Commit

Permalink
Add SSL support to Consul inventory script
Browse files Browse the repository at this point in the history
Change passes in the scheme argument to python-consul's Consul
initializer. Default scheme is set to http.
  • Loading branch information
John M. Carlin authored and bcoca committed Oct 25, 2016
1 parent dd80797 commit ef7fd10
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion contrib/inventory/consul_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ def get_consul_api(self):
host = 'localhost'
port = 8500
token = None
scheme = 'http'

if hasattr(self, 'url'):
from urlparse import urlparse
Expand All @@ -473,11 +474,13 @@ def get_consul_api(self):
host = o.hostname
if o.port:
port = o.port
if o.scheme:
scheme = o.scheme

if hasattr(self, 'token'):
token = self.token
if not token:
token = 'anonymous'
return consul.Consul(host=host, port=port, token=token)
return consul.Consul(host=host, port=port, token=token, scheme=scheme)

ConsulInventory()

0 comments on commit ef7fd10

Please sign in to comment.