Merge "create service endpoints in sample data"
This commit is contained in:
commit
9d245f8b68
@ -19,11 +19,15 @@ import sqlalchemy.exc
|
|||||||
import webob.exc
|
import webob.exc
|
||||||
|
|
||||||
from keystone import catalog
|
from keystone import catalog
|
||||||
|
from keystone import config
|
||||||
from keystone import exception
|
from keystone import exception
|
||||||
from keystone.common import sql
|
from keystone.common import sql
|
||||||
from keystone.common.sql import migration
|
from keystone.common.sql import migration
|
||||||
|
|
||||||
|
|
||||||
|
CONF = config.CONF
|
||||||
|
|
||||||
|
|
||||||
class Service(sql.ModelBase, sql.DictBase):
|
class Service(sql.ModelBase, sql.DictBase):
|
||||||
__tablename__ = 'service'
|
__tablename__ = 'service'
|
||||||
id = sql.Column(sql.String(64), primary_key=True)
|
id = sql.Column(sql.String(64), primary_key=True)
|
||||||
@ -140,7 +144,9 @@ class Catalog(sql.Base):
|
|||||||
return [e['id'] for e in list(endpoints)]
|
return [e['id'] for e in list(endpoints)]
|
||||||
|
|
||||||
def get_catalog(self, user_id, tenant_id, metadata=None):
|
def get_catalog(self, user_id, tenant_id, metadata=None):
|
||||||
d = {'tenant_id': tenant_id, 'user_id': user_id}
|
d = dict(CONF.iteritems())
|
||||||
|
d.update({'tenant_id': tenant_id,
|
||||||
|
'user_id': user_id})
|
||||||
catalog = {}
|
catalog = {}
|
||||||
|
|
||||||
endpoints = [self.get_endpoint(e)
|
endpoints = [self.get_endpoint(e)
|
||||||
|
@ -31,6 +31,10 @@
|
|||||||
# Enable the Swift and Quantum accounts by setting ENABLE_SWIFT and/or
|
# Enable the Swift and Quantum accounts by setting ENABLE_SWIFT and/or
|
||||||
# ENABLE_QUANTUM environment variables.
|
# ENABLE_QUANTUM environment variables.
|
||||||
#
|
#
|
||||||
|
# Enable creation of endpoints by setting ENABLE_ENDPOINTS environment variable.
|
||||||
|
# Works with Catalog SQL backend. Do not use with Catalog Templated backend
|
||||||
|
# (default).
|
||||||
|
#
|
||||||
# A set of EC2-compatible credentials is created for both admin and demo
|
# A set of EC2-compatible credentials is created for both admin and demo
|
||||||
# users and placed in etc/ec2rc.
|
# users and placed in etc/ec2rc.
|
||||||
#
|
#
|
||||||
@ -75,7 +79,7 @@ fi
|
|||||||
export SERVICE_ENDPOINT=${SERVICE_ENDPOINT:-http://127.0.0.1:${CONFIG_ADMIN_PORT:-35357}/v2.0}
|
export SERVICE_ENDPOINT=${SERVICE_ENDPOINT:-http://127.0.0.1:${CONFIG_ADMIN_PORT:-35357}/v2.0}
|
||||||
|
|
||||||
function get_id () {
|
function get_id () {
|
||||||
echo `$@ | grep ' id ' | awk '{print $4}'`
|
echo `"$@" | grep ' id ' | awk '{print $4}'`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -118,9 +122,10 @@ keystone user-role-add --user $ADMIN_USER --role $KEYSTONESERVICE_ROLE --tenant_
|
|||||||
|
|
||||||
|
|
||||||
# Services
|
# Services
|
||||||
|
NOVA_SERVICE=$(get_id \
|
||||||
keystone service-create --name=nova \
|
keystone service-create --name=nova \
|
||||||
--type=compute \
|
--type=compute \
|
||||||
--description="Nova Compute Service"
|
--description="Nova Compute Service")
|
||||||
NOVA_USER=$(get_id keystone user-create --name=nova \
|
NOVA_USER=$(get_id keystone user-create --name=nova \
|
||||||
--pass="$SERVICE_PASSWORD" \
|
--pass="$SERVICE_PASSWORD" \
|
||||||
--tenant_id $SERVICE_TENANT \
|
--tenant_id $SERVICE_TENANT \
|
||||||
@ -128,14 +133,28 @@ NOVA_USER=$(get_id keystone user-create --name=nova \
|
|||||||
keystone user-role-add --tenant_id $SERVICE_TENANT \
|
keystone user-role-add --tenant_id $SERVICE_TENANT \
|
||||||
--user $NOVA_USER \
|
--user $NOVA_USER \
|
||||||
--role $ADMIN_ROLE
|
--role $ADMIN_ROLE
|
||||||
|
if [[ -n "$ENABLE_ENDPOINTS" ]]; then
|
||||||
|
keystone endpoint-create --region RegionOne --service_id $NOVA_SERVICE \
|
||||||
|
--publicurl 'http://localhost:$(compute_port)s/v1.1/$(tenant_id)s' \
|
||||||
|
--adminurl 'http://localhost:$(compute_port)s/v1.1/$(tenant_id)s' \
|
||||||
|
--internalurl 'http://localhost:$(compute_port)s/v1.1/$(tenant_id)s'
|
||||||
|
fi
|
||||||
|
|
||||||
|
EC2_SERVICE=$(get_id \
|
||||||
keystone service-create --name=ec2 \
|
keystone service-create --name=ec2 \
|
||||||
--type=ec2 \
|
--type=ec2 \
|
||||||
--description="EC2 Compatibility Layer"
|
--description="EC2 Compatibility Layer")
|
||||||
|
if [[ -n "$ENABLE_ENDPOINTS" ]]; then
|
||||||
|
keystone endpoint-create --region RegionOne --service_id $EC2_SERVICE \
|
||||||
|
--publicurl http://localhost:8773/services/Cloud \
|
||||||
|
--adminurl http://localhost:8773/services/Admin \
|
||||||
|
--internalurl http://localhost:8773/services/Cloud
|
||||||
|
fi
|
||||||
|
|
||||||
|
GLANCE_SERVICE=$(get_id \
|
||||||
keystone service-create --name=glance \
|
keystone service-create --name=glance \
|
||||||
--type=image \
|
--type=image \
|
||||||
--description="Glance Image Service"
|
--description="Glance Image Service")
|
||||||
GLANCE_USER=$(get_id keystone user-create --name=glance \
|
GLANCE_USER=$(get_id keystone user-create --name=glance \
|
||||||
--pass="$SERVICE_PASSWORD" \
|
--pass="$SERVICE_PASSWORD" \
|
||||||
--tenant_id $SERVICE_TENANT \
|
--tenant_id $SERVICE_TENANT \
|
||||||
@ -143,14 +162,34 @@ GLANCE_USER=$(get_id keystone user-create --name=glance \
|
|||||||
keystone user-role-add --tenant_id $SERVICE_TENANT \
|
keystone user-role-add --tenant_id $SERVICE_TENANT \
|
||||||
--user $GLANCE_USER \
|
--user $GLANCE_USER \
|
||||||
--role $ADMIN_ROLE
|
--role $ADMIN_ROLE
|
||||||
|
if [[ -n "$ENABLE_ENDPOINTS" ]]; then
|
||||||
|
keystone endpoint-create --region RegionOne --service_id $GLANCE_SERVICE \
|
||||||
|
--publicurl http://localhost:9292/v1 \
|
||||||
|
--adminurl http://localhost:9292/v1 \
|
||||||
|
--internalurl http://localhost:9292/v1
|
||||||
|
fi
|
||||||
|
|
||||||
|
KEYSTONE_SERVICE=$(get_id \
|
||||||
keystone service-create --name=keystone \
|
keystone service-create --name=keystone \
|
||||||
--type=identity \
|
--type=identity \
|
||||||
--description="Keystone Identity Service"
|
--description="Keystone Identity Service")
|
||||||
|
if [[ -n "$ENABLE_ENDPOINTS" ]]; then
|
||||||
|
keystone endpoint-create --region RegionOne --service_id $KEYSTONE_SERVICE \
|
||||||
|
--publicurl 'http://localhost:$(public_port)s/v2.0' \
|
||||||
|
--adminurl 'http://localhost:$(admin_port)s/v2.0' \
|
||||||
|
--internalurl 'http://localhost:$(admin_port)s/v2.0'
|
||||||
|
fi
|
||||||
|
|
||||||
|
VOLUME_SERVICE=$(get_id \
|
||||||
keystone service-create --name="nova-volume" \
|
keystone service-create --name="nova-volume" \
|
||||||
--type=volume \
|
--type=volume \
|
||||||
--description="Nova Volume Service"
|
--description="Nova Volume Service")
|
||||||
|
if [[ -n "$ENABLE_ENDPOINTS" ]]; then
|
||||||
|
keystone endpoint-create --region RegionOne --service_id $VOLUME_SERVICE \
|
||||||
|
--publicurl 'http://localhost:8776/v1/$(tenant_id)s' \
|
||||||
|
--adminurl 'http://localhost:8776/v1/$(tenant_id)s' \
|
||||||
|
--internalurl 'http://localhost:8776/v1/$(tenant_id)s'
|
||||||
|
fi
|
||||||
|
|
||||||
keystone service-create --name="horizon" \
|
keystone service-create --name="horizon" \
|
||||||
--type=dashboard \
|
--type=dashboard \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user