Fix setup-service script error

replace service to services, Add create role services

Closes-Bug: #1676158
Signed-off-by: chenyb4 <cybing4@gmail.com>
Change-Id: Iaeec8aa1e0c10f21240d7ada5e7245939e408384
This commit is contained in:
chenyb4 2017-03-26 20:53:50 +08:00 committed by tengqm
parent 630f5539ef
commit 388dad36b8

View File

@ -23,6 +23,8 @@ HOST=$1 # Put your host IP here
SVC_PASSWD=$2 SVC_PASSWD=$2
OS_REGION_NAME=${OS_REGION_NAME:-RegionOne} OS_REGION_NAME=${OS_REGION_NAME:-RegionOne}
OS_IDENTITY_API_VERSION=${OS_IDENTITY_API_VERSION:-3} OS_IDENTITY_API_VERSION=${OS_IDENTITY_API_VERSION:-3}
SERVICE_PROJECT=${OS_SERVICE_PROJECT:-service}
SERVICE_ROLE=${OS_SERVICE_ROLE:-service}
SERVICE_ID=$(openstack service show senlin -f value -cid 2>/dev/null) SERVICE_ID=$(openstack service show senlin -f value -cid 2>/dev/null)
if [[ -z $SERVICE_ID ]]; then if [[ -z $SERVICE_ID ]]; then
@ -53,19 +55,28 @@ else
senlin senlin
fi fi
# Check service project name.
# Devstack uses 'service' while some distributions use 'services'
PROJECT_ID=$(openstack project show service -f value -cid 2>/dev/null)
if [[ -z $PROJECT_ID ]]; then
SERVICE_PROJECT=services
SERVICE_ROLE=services
openstack role create $SERVICE_ROLE
fi
openstack user create \ openstack user create \
--password "$SVC_PASSWD" \ --password "$SVC_PASSWD" \
--project service \ --project $SERVICE_PROJECT \
--email senlin@localhost \ --email senlin@localhost \
senlin senlin
openstack role add \ openstack role add \
admin \ admin \
--user senlin \ --user senlin \
--project service --project $SERVICE_PROJECT
# make sure 'senlin' has 'service' role in 'demo' project # make sure 'senlin' has service role on 'demo' project
openstack role add \ openstack role add \
service \ $SERVICE_ROLE \
--user senlin \ --user senlin \
--project demo --project demo