Add SSL support to Consul inventory script
Change passes in the scheme argument to python-consul's Consul initializer. Default scheme is set to http.
This commit is contained in:
parent
dd8079776d
commit
ef7fd10b15
1 changed files with 4 additions and 1 deletions
|
@ -465,6 +465,7 @@ class ConsulConfig(dict):
|
||||||
host = 'localhost'
|
host = 'localhost'
|
||||||
port = 8500
|
port = 8500
|
||||||
token = None
|
token = None
|
||||||
|
scheme = 'http'
|
||||||
|
|
||||||
if hasattr(self, 'url'):
|
if hasattr(self, 'url'):
|
||||||
from urlparse import urlparse
|
from urlparse import urlparse
|
||||||
|
@ -473,11 +474,13 @@ class ConsulConfig(dict):
|
||||||
host = o.hostname
|
host = o.hostname
|
||||||
if o.port:
|
if o.port:
|
||||||
port = o.port
|
port = o.port
|
||||||
|
if o.scheme:
|
||||||
|
scheme = o.scheme
|
||||||
|
|
||||||
if hasattr(self, 'token'):
|
if hasattr(self, 'token'):
|
||||||
token = self.token
|
token = self.token
|
||||||
if not token:
|
if not token:
|
||||||
token = 'anonymous'
|
token = 'anonymous'
|
||||||
return consul.Consul(host=host, port=port, token=token)
|
return consul.Consul(host=host, port=port, token=token, scheme=scheme)
|
||||||
|
|
||||||
ConsulInventory()
|
ConsulInventory()
|
||||||
|
|
Loading…
Reference in a new issue