From f8e1c3339c90ee84ed73d8feb418202b9b4de4c9 Mon Sep 17 00:00:00 2001 From: TerryHowe Date: Thu, 2 Jul 2015 10:29:01 -0600 Subject: [PATCH] Fix cacert for tests and examples Change-Id: I84685d6cd3478fcab249e69555f494a036567b87 --- examples/connection.py | 6 ++++++ openstack/tests/functional/base.py | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/examples/connection.py b/examples/connection.py index c1c4adec6..44f97d822 100644 --- a/examples/connection.py +++ b/examples/connection.py @@ -31,7 +31,13 @@ def make_connection(opts): occ = os_client_config.OpenStackConfig() cloud = occ.get_one_cloud(opts.cloud, opts) opts.preferences.set_region(opts.preferences.ALL, cloud.region) + # TODO(thowe): There is a general smell here that this code is + # repeated in two places at that we flatten the auth structure. + # The connection class should take OCC config and just deal, but + # I'd just like to get cacert working for now. auth = cloud.config['auth'] + if 'cacert' in cloud.config: + auth['verify'] = cloud.config['cacert'] if 'insecure' in cloud.config: auth['verify'] = not bool(cloud.config['insecure']) conn = connection.Connection(profile=opts.preferences, **auth) diff --git a/openstack/tests/functional/base.py b/openstack/tests/functional/base.py index 8bb560c10..7ed41f0dc 100644 --- a/openstack/tests/functional/base.py +++ b/openstack/tests/functional/base.py @@ -65,7 +65,13 @@ class BaseFunctionalTest(unittest.TestCase): if test_cloud.debug: utils.enable_logging(True, stream=sys.stdout) + # TODO(thowe): There is a general smell here that this code is + # repeated in two places at that we flatten the auth structure. + # The connection class should take OCC config and just deal, but + # I'd just like to get cacert working for now. auth = test_cloud.config['auth'] + if 'cacert' in test_cloud.config: + auth['verify'] = test_cloud.config['cacert'] if 'insecure' in test_cloud.config: auth['verify'] = not bool(test_cloud.config['insecure']) cls.conn = connection.Connection(profile=prof, **auth)