Convert all Keystone-specific configs to nested
Depends-On: I393f8898657543a8c4536159e9a6d773b13cefbf Change-Id: Ic67ad0881d98eec7980971b3aebfd4b005705504
This commit is contained in:
parent
0576d86079
commit
0ec12d9329
|
@ -93,7 +93,7 @@ def _cleanup_network_resources(session):
|
|||
|
||||
|
||||
def _cleanup_openstack_environment(configs, auth_url=None):
|
||||
if 'openstack_project_name' not in configs:
|
||||
if 'project_name' not in configs.get('openstack', {}):
|
||||
# Ensure that keystone configs are provided. Assume that it is not an
|
||||
# OpenStack deployment otherwise
|
||||
raise RuntimeError('There are no Keystone configs provided. '
|
||||
|
@ -101,11 +101,12 @@ def _cleanup_openstack_environment(configs, auth_url=None):
|
|||
'is not deployed')
|
||||
|
||||
configs['auth_url'] = auth_url or 'http://%s:%s/v3' % (
|
||||
utils.address('keystone'), configs['keystone_public_port'])
|
||||
utils.address('keystone'), configs['keystone']['public_port'])
|
||||
|
||||
session = _get_session(
|
||||
configs['auth_url'], configs['openstack_user_name'],
|
||||
configs['openstack_user_password'], configs['openstack_project_name'])
|
||||
configs['auth_url'], configs['openstack']['user_name'],
|
||||
configs['openstack']['user_password'],
|
||||
configs['openstack']['project_name'])
|
||||
|
||||
try:
|
||||
session.get_project_id()
|
||||
|
|
|
@ -378,14 +378,16 @@ def _create_namespace(configs):
|
|||
|
||||
|
||||
def _create_openrc(config):
|
||||
openrc = ["export OS_PROJECT_DOMAIN_NAME=default",
|
||||
"export OS_USER_DOMAIN_NAME=default",
|
||||
"export OS_PROJECT_NAME=%s" % config['openstack_project_name'],
|
||||
"export OS_USERNAME=%s" % config['openstack_user_name'],
|
||||
"export OS_PASSWORD=%s" % config['openstack_user_password'],
|
||||
"export OS_IDENTITY_API_VERSION=3",
|
||||
"export OS_AUTH_URL=http://%s:%s/v3" %
|
||||
(utils.address('keystone'), config['keystone_public_port'])]
|
||||
openrc = [
|
||||
"export OS_PROJECT_DOMAIN_NAME=default",
|
||||
"export OS_USER_DOMAIN_NAME=default",
|
||||
"export OS_PROJECT_NAME=%s" % config['openstack']['project_name'],
|
||||
"export OS_USERNAME=%s" % config['openstack']['user_name'],
|
||||
"export OS_PASSWORD=%s" % config['openstack']['user_password'],
|
||||
"export OS_IDENTITY_API_VERSION=3",
|
||||
"export OS_AUTH_URL=http://%s:%s/v3" %
|
||||
(utils.address('keystone'), config['keystone']['public_port']),
|
||||
]
|
||||
with open('openrc-%s' % config['namespace'], 'w') as openrc_file:
|
||||
openrc_file.write("\n".join(openrc))
|
||||
LOG.info("Openrc file for this deployment created at %s/openrc-%s",
|
||||
|
|
|
@ -100,19 +100,25 @@ class TestDeploy(base.TestCase):
|
|||
namespace = self.namespace
|
||||
openrc_etalon_file = 'openrc-%s-etalon' % namespace
|
||||
openrc_test_file = 'openrc-%s' % namespace
|
||||
config = {"openstack_project_name": "admin",
|
||||
"openstack_user_name": "admin",
|
||||
"openstack_user_password": "password",
|
||||
"keystone_public_port": 5000,
|
||||
"namespace": self.namespace}
|
||||
rc = ["export OS_PROJECT_DOMAIN_NAME=default",
|
||||
"export OS_USER_DOMAIN_NAME=default",
|
||||
"export OS_PROJECT_NAME=%s" % config['openstack_project_name'],
|
||||
"export OS_USERNAME=%s" % config['openstack_user_name'],
|
||||
"export OS_PASSWORD=%s" % config['openstack_user_password'],
|
||||
"export OS_IDENTITY_API_VERSION=3",
|
||||
"export OS_AUTH_URL=http://keystone.ccp:%s/v3" %
|
||||
config['keystone_public_port']]
|
||||
config = {
|
||||
"openstack": {
|
||||
"project_name": "admin",
|
||||
"user_name": "admin",
|
||||
"user_password": "password",
|
||||
},
|
||||
"keystone": {"public_port": 5000},
|
||||
"namespace": self.namespace,
|
||||
}
|
||||
rc = [
|
||||
"export OS_PROJECT_DOMAIN_NAME=default",
|
||||
"export OS_USER_DOMAIN_NAME=default",
|
||||
"export OS_PROJECT_NAME=%s" % config['openstack']['project_name'],
|
||||
"export OS_USERNAME=%s" % config['openstack']['user_name'],
|
||||
"export OS_PASSWORD=%s" % config['openstack']['user_password'],
|
||||
"export OS_IDENTITY_API_VERSION=3",
|
||||
"export OS_AUTH_URL=http://keystone.ccp:%s/v3" %
|
||||
config['keystone']['public_port'],
|
||||
]
|
||||
|
||||
with open(openrc_etalon_file, 'w') as openrc_file:
|
||||
openrc_file.write("\n".join(rc))
|
||||
|
|
Loading…
Reference in New Issue