summaryrefslogtreecommitdiff
path: root/docker/utils/utils.py
diff options
context:
space:
mode:
authorAanand Prasad <aanand.prasad@gmail.com>2015-07-21 16:50:41 +0100
committerAanand Prasad <aanand.prasad@gmail.com>2015-07-21 16:50:44 +0100
commit75cc50f0ad2c0d39126f3dd1112235d338d78c4d (patch)
treeb29ecc68a2935f85004d592101945450d4809ebe /docker/utils/utils.py
parent2c08ad21dd9aa0c01936e6184574cd105a2b3f64 (diff)
downloaddocker-py-75cc50f0ad2c0d39126f3dd1112235d338d78c4d.tar.gz
Default to ~/.docker if DOCKER_CERT_PATH is empty
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
Diffstat (limited to 'docker/utils/utils.py')
-rw-r--r--docker/utils/utils.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/docker/utils/utils.py b/docker/utils/utils.py
index 10c08de..e5e974a 100644
--- a/docker/utils/utils.py
+++ b/docker/utils/utils.py
@@ -314,9 +314,15 @@ def kwargs_from_env(ssl_version=None, assert_hostname=None):
tls_verify = os.environ.get('DOCKER_TLS_VERIFY')
params = {}
+
if host:
params['base_url'] = (host.replace('tcp://', 'https://')
if tls_verify else host)
+
+ if tls_verify and not cert_path:
+ if 'HOME' in os.environ:
+ cert_path = os.path.join(os.environ['HOME'], '.docker')
+
if tls_verify and cert_path:
params['tls'] = tls.TLSConfig(
client_cert=(os.path.join(cert_path, 'cert.pem'),
@@ -325,6 +331,7 @@ def kwargs_from_env(ssl_version=None, assert_hostname=None):
verify=True,
ssl_version=ssl_version,
assert_hostname=assert_hostname)
+
return params