From ef7fd10b1563ff8d4465b2a9c1a4fd224e15a0b6 Mon Sep 17 00:00:00 2001 From: "John M. Carlin" Date: Thu, 6 Oct 2016 11:01:19 -0500 Subject: [PATCH] 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. --- contrib/inventory/consul_io.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contrib/inventory/consul_io.py b/contrib/inventory/consul_io.py index 9130dbd9e72..cf622ed6c4a 100755 --- a/contrib/inventory/consul_io.py +++ b/contrib/inventory/consul_io.py @@ -465,6 +465,7 @@ class ConsulConfig(dict): host = 'localhost' port = 8500 token = None + scheme = 'http' if hasattr(self, 'url'): from urlparse import urlparse @@ -473,11 +474,13 @@ class ConsulConfig(dict): 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()