more keystone fixes

This commit is contained in:
Joshua Harlow
2012-03-07 10:35:38 -08:00
parent 9186e6440d
commit 4c2bc6f68a
5 changed files with 12 additions and 13 deletions

View File

@@ -190,8 +190,7 @@ class GlanceInstaller(comp.PythonInstallComponent):
mp['SQL_CONN'] = self.cfg.get_dbdsn(DB_NAME)
mp['SERVICE_HOST'] = self.cfg.get('host', 'ip')
mp['HOST_IP'] = self.cfg.get('host', 'ip')
mp['SERVICE_USERNAME'] = 'glance'
mp.update(keystone.get_shared_params(self.cfg))
mp.update(keystone.get_shared_params(self.cfg, 'glance'))
return mp

View File

@@ -254,20 +254,25 @@ class KeystoneRuntime(comp.PythonRuntime):
return APP_OPTIONS.get(app)
def get_shared_params(config):
def get_shared_params(config, service_user_name=None):
mp = dict()
host_ip = config.get('host', 'ip')
#these match what is in keystone_init.sh
mp['SERVICE_TENANT_NAME'] = 'service'
if service_user_name:
mp['SERVICE_USERNAME'] = str(service_user_name)
mp['ADMIN_USER_NAME'] = 'admin'
mp['DEMO_USER_NAME'] = 'demo'
mp['ADMIN_TENANT_NAME'] = mp['ADMIN_USER_NAME']
mp['DEMO_TENANT_NAME'] = mp['DEMO_USER_NAME']
#tokens and passwords
mp['SERVICE_TOKEN'] = config.get("passwords", "service_token")
mp['ADMIN_PASSWORD'] = config.get('passwords', 'horizon_keystone_admin')
mp['SERVICE_PASSWORD'] = config.get('passwords', 'service_password')
#components of the auth endpoint
keystone_auth_host = config.getdefaulted('keystone', 'keystone_auth_host', host_ip)
mp['KEYSTONE_AUTH_HOST'] = keystone_auth_host
keystone_auth_port = config.get('keystone', 'keystone_auth_port')
@@ -275,6 +280,7 @@ def get_shared_params(config):
keystone_auth_proto = config.get('keystone', 'keystone_auth_protocol')
mp['KEYSTONE_AUTH_PROTOCOL'] = keystone_auth_proto
#components of the service endpoint
keystone_service_host = config.getdefaulted('keystone', 'keystone_service_host', host_ip)
mp['KEYSTONE_SERVICE_HOST'] = keystone_service_host
keystone_service_port = config.get('keystone', 'keystone_service_port')
@@ -282,15 +288,12 @@ def get_shared_params(config):
keystone_service_proto = config.get('keystone', 'keystone_service_protocol')
mp['KEYSTONE_SERVICE_PROTOCOL'] = keystone_service_proto
#TODO is this right???
#http/https endpoints
mp['AUTH_ENDPOINT'] = urlunparse((keystone_auth_proto,
"%s:%s" % (keystone_auth_host, keystone_auth_port),
"v2.0", "", "", ""))
#TODO is this right???
mp['SERVICE_ENDPOINT'] = urlunparse((keystone_service_proto,
"%s:%s" % (keystone_service_host, keystone_service_port),
"v2.0", "", "", ""))
mp['SERVICE_TOKEN'] = config.get("passwords", "service_token")
return mp

View File

@@ -442,9 +442,7 @@ class NovaInstaller(comp.PythonInstallComponent):
mp['FIXED_NETWORK_SIZE'] = self.cfg.get('nova', 'fixed_network_size')
mp['FIXED_RANGE'] = self.cfg.get('nova', 'fixed_range')
else:
mp = keystone.get_shared_params(self.cfg)
mp['SERVICE_PASSWORD'] = "???"
mp['SERVICE_USER'] = "???"
mp.update(keystone.get_shared_params(self.cfg, 'nova'))
return mp
def configure(self):

View File

@@ -111,8 +111,7 @@ class RcGenerator(object):
def _generate_os_env(self):
lines = list()
lines.append('# Openstack stuff')
lines.extend(self._make_export_cfg('OS_PASSWORD',
('passwords', 'horizon_keystone_admin')))
lines.extend(self._make_export_cfg('OS_PASSWORD', ('passwords', 'horizon_keystone_admin')))
key_params = keystone.get_shared_params(self.cfg)
lines.extend(self._make_export('OS_TENANT_NAME', key_params['DEMO_TENANT_NAME']))
lines.extend(self._make_export('OS_USERNAME', key_params['DEMO_USER_NAME']))

View File

@@ -221,7 +221,7 @@ class ImageCreationService:
keystone_service_url = key_params['SERVICE_ENDPOINT']
keystone_token_url = "%s/tokens" % (keystone_service_url)
#form the post json data
# form the post json data
data = json.dumps(
{
"auth":