[rally env]Move (https_cert, https_key) to OpenStackCredential
Add https_key argument in OpenStackCredential, support the spec which the https_cert and https_key were None value. Change-Id: Ib8fa61692383c4629f124f48183fb2f3de986f0e
This commit is contained in:
parent
a3a7c66ff3
commit
c7483386e6
|
@ -27,7 +27,8 @@ class OpenStackCredential(dict):
|
||||||
region_name=None, endpoint_type=None,
|
region_name=None, endpoint_type=None,
|
||||||
domain_name=None, endpoint=None, user_domain_name=None,
|
domain_name=None, endpoint=None, user_domain_name=None,
|
||||||
project_domain_name=None,
|
project_domain_name=None,
|
||||||
https_insecure=False, https_cacert=None, https_cert=None,
|
https_insecure=False, https_cacert=None,
|
||||||
|
https_cert=None, https_key=None,
|
||||||
profiler_hmac_key=None, profiler_conn_str=None,
|
profiler_hmac_key=None, profiler_conn_str=None,
|
||||||
api_info=None, **kwargs):
|
api_info=None, **kwargs):
|
||||||
if kwargs:
|
if kwargs:
|
||||||
|
@ -35,6 +36,9 @@ class OpenStackCredential(dict):
|
||||||
|
|
||||||
# TODO(andreykurilin): deprecate permission and endpoint
|
# TODO(andreykurilin): deprecate permission and endpoint
|
||||||
|
|
||||||
|
if https_cert and https_key:
|
||||||
|
https_cert = (https_cert, https_key)
|
||||||
|
|
||||||
super(OpenStackCredential, self).__init__([
|
super(OpenStackCredential, self).__init__([
|
||||||
("auth_url", auth_url),
|
("auth_url", auth_url),
|
||||||
("username", username),
|
("username", username),
|
||||||
|
|
|
@ -135,10 +135,6 @@ class OpenStack(platform.Platform):
|
||||||
users = new_data.pop("users", [])
|
users = new_data.pop("users", [])
|
||||||
api_info = new_data.pop("api_info", None)
|
api_info = new_data.pop("api_info", None)
|
||||||
|
|
||||||
if new_data.get("https_cert") and new_data.get("https_key"):
|
|
||||||
new_data["https_cert"] = (new_data["https_cert"],
|
|
||||||
new_data.pop("https_key"))
|
|
||||||
|
|
||||||
if admin:
|
if admin:
|
||||||
if "project_name" in admin:
|
if "project_name" in admin:
|
||||||
admin["tenant_name"] = admin.pop("project_name")
|
admin["tenant_name"] = admin.pop("project_name")
|
||||||
|
|
|
@ -192,3 +192,16 @@ class EnvTestCase(unittest.TestCase):
|
||||||
except utils.RallyCliError as e:
|
except utils.RallyCliError as e:
|
||||||
self.assertIn("Can not create 'faileddummy' with 2 version",
|
self.assertIn("Can not create 'faileddummy' with 2 version",
|
||||||
e.output)
|
e.output)
|
||||||
|
|
||||||
|
def test_create_env_with_https_cert_https_key(self):
|
||||||
|
rally = utils.Rally()
|
||||||
|
fake_spec = copy.deepcopy(rally.env_spec)
|
||||||
|
fake_spec["existing@openstack"]["https_cert"] = ""
|
||||||
|
fake_spec["existing@openstack"]["https_key"] = ""
|
||||||
|
spec = utils.JsonTempFile(fake_spec)
|
||||||
|
rally("env create --name t_create_env --spec %s" % spec.filename)
|
||||||
|
config = rally("env show --only-spec", getjson=True)
|
||||||
|
self.assertIn("https_cert", config["existing@openstack"].keys())
|
||||||
|
self.assertIn("https_key", config["existing@openstack"].keys())
|
||||||
|
rally("env check")
|
||||||
|
rally("env info")
|
||||||
|
|
Loading…
Reference in New Issue