From b72e025d7e04efc7babbf2988531fcb3b431dc3f Mon Sep 17 00:00:00 2001 From: Michael Hwang Date: Wed, 18 Oct 2017 16:59:41 -0400 Subject: Turn off cert validation Change-Id: Ie43b6ffd4b50ee08ad65015d43ec262ba0b2b7f8 Issue-Id: DCAEGEN2-189 Signed-off-by: Michael Hwang --- python-dockering/ChangeLog.md | 4 ++++ python-dockering/dockering/config_building.py | 5 +++++ python-dockering/setup.py | 2 +- python-dockering/tests/test_config_building.py | 3 ++- python-dockering/tests/test_core.py | 3 ++- 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/python-dockering/ChangeLog.md b/python-dockering/ChangeLog.md index 9c7781d..b222e5d 100644 --- a/python-dockering/ChangeLog.md +++ b/python-dockering/ChangeLog.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [1.4.0] + +* Turn off cert verification for https healthchecks. See comments in the the code. + ## [1.3.0] * Fix issue with returning container ports as dict keys when list was expected diff --git a/python-dockering/dockering/config_building.py b/python-dockering/dockering/config_building.py index 564e5de..08fd1c0 100644 --- a/python-dockering/dockering/config_building.py +++ b/python-dockering/dockering/config_building.py @@ -60,6 +60,11 @@ def create_envs_healthcheck(docker_config, default_interval="15s", # WATCH: HTTPS health checks don't work. Seems like Registrator bug. # Submitted issue https://github.com/gliderlabs/registrator/issues/516 envs["SERVICE_CHECK_HTTPS"] = hc["endpoint"] + # Went with one of the suggestiong from the posted issue above. This + # author is skeptical whether https healthchecks will ever work with + # server cert verification because the hostname is actually the ip + # address. + envs["SERVICE_CHECK_TLS_SKIP_VERIFY"] = "true" utils.logger.warn("Https-based health checks may not work because Registrator issue #516") elif hc["type"] == "script": envs["SERVICE_CHECK_SCRIPT"] = hc["script"] diff --git a/python-dockering/setup.py b/python-dockering/setup.py index ab87e62..45da8de 100644 --- a/python-dockering/setup.py +++ b/python-dockering/setup.py @@ -23,7 +23,7 @@ from setuptools import setup setup( name='onap-dcae-dockering', description='Library used to manage Docker containers in DCAE', - version="1.3.0", + version="1.4.0", license='Apache 2', author="Michael Hwang", email="mhwang@research.att.com", diff --git a/python-dockering/tests/test_config_building.py b/python-dockering/tests/test_config_building.py index ff1b409..16ecb58 100644 --- a/python-dockering/tests/test_config_building.py +++ b/python-dockering/tests/test_config_building.py @@ -93,7 +93,8 @@ def test_create_envs_healthcheck(): expected = { "SERVICE_CHECK_HTTPS": endpoint, "SERVICE_CHECK_INTERVAL": interval, - "SERVICE_CHECK_TIMEOUT": timeout + "SERVICE_CHECK_TIMEOUT": timeout, + "SERVICE_CHECK_TLS_SKIP_VERIFY": "true" } assert expected == doc.create_envs_healthcheck(docker_config) diff --git a/python-dockering/tests/test_core.py b/python-dockering/tests/test_core.py index f66f88c..76e027b 100644 --- a/python-dockering/tests/test_core.py +++ b/python-dockering/tests/test_core.py @@ -30,7 +30,8 @@ def test_create_client(): # Bad - Could not connect to docker engine with pytest.raises(DockerConnectionError): - doc.create_client("fake", 2376, reauth=True) + doc.create_client("fake", 2376, reauth=True, logins=[{ + "registry": "nowhere", "username": "bob", "password": "123"}]) # TODO: Does pytest provide an env file? -- cgit 1.2.3-korg