Merge "Fix cacert for tests and examples"

This commit is contained in:
Jenkins
2015-07-08 15:41:54 +00:00
committed by Gerrit Code Review
2 changed files with 12 additions and 0 deletions

View File

@@ -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)

View File

@@ -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)