Make rally support https insecure deployment 47/36447/2
authorLinda Wang <wangwulin@huawei.com>
Sat, 24 Jun 2017 09:15:56 +0000 (09:15 +0000)
committerLinda Wang <wangwulin@huawei.com>
Sat, 24 Jun 2017 09:20:22 +0000 (09:20 +0000)
When running in https environment, rally should support insecure
deployment if no cacert file is provided.

JIRA: FUNCTEST-828

Change-Id: I29b0fc8c2e1b74a1ce08293706cd9f11f975b6d5
Signed-off-by: Linda Wang <wangwulin@huawei.com>
functest/tests/unit/utils/test_openstack_utils.py
functest/utils/openstack_utils.py

index 0f06b1e..33d0ee4 100644 (file)
@@ -27,7 +27,8 @@ class OSUtilsTesting(unittest.TestCase):
                 'OS_PROJECT_NAME': os_prefix + 'project_name',
                 'OS_ENDPOINT_TYPE': os_prefix + 'endpoint_type',
                 'OS_REGION_NAME': os_prefix + 'region_name',
-                'OS_CACERT': os_prefix + 'https_cacert'}
+                'OS_CACERT': os_prefix + 'https_cacert',
+                'OS_INSECURE': os_prefix + 'https_insecure'}
 
     def _get_os_env_vars(self):
         return {'username': 'test_username', 'password': 'test_password',
@@ -37,7 +38,8 @@ class OSUtilsTesting(unittest.TestCase):
                 'project_name': 'test_project_name',
                 'endpoint_type': 'test_endpoint_type',
                 'region_name': 'test_region_name',
-                'https_cacert': 'test_https_cacert'}
+                'https_cacert': 'test_https_cacert',
+                'https_insecure': 'test_https_insecure'}
 
     def setUp(self):
         self.env_vars = ['OS_AUTH_URL', 'OS_USERNAME', 'OS_PASSWORD']
index a896626..0b9f8b8 100644 (file)
@@ -82,7 +82,8 @@ def get_env_cred_dict():
         'OS_PROJECT_NAME': 'project_name',
         'OS_ENDPOINT_TYPE': 'endpoint_type',
         'OS_REGION_NAME': 'region_name',
-        'OS_CACERT': 'https_cacert'
+        'OS_CACERT': 'https_cacert',
+        'OS_INSECURE': 'https_insecure'
     }
     return env_cred_dict
 
@@ -150,10 +151,12 @@ def get_credentials_for_rally():
         cred_key = env_cred_dict.get('OS_REGION_NAME')
         rally_conf[cred_key] = region_name
 
-    cacert = os.getenv('OS_CACERT')
-    if cacert is not None:
-        cred_key = env_cred_dict.get('OS_CACERT')
-        rally_conf[cred_key] = cacert
+    cred_key = env_cred_dict.get('OS_CACERT')
+    rally_conf[cred_key] = os.getenv('OS_CACERT', '')
+
+    insecure_key = env_cred_dict.get('OS_INSECURE')
+    rally_conf[insecure_key] = os.getenv('OS_INSECURE', '').lower() == 'true'
+
     return rally_conf