Merge "Updates to glance start scripts, db and user/role creation - adding db sync and db creation as utf8 - fixing user and role creation"
This commit is contained in:
commit
9ce465d544
@ -12,8 +12,8 @@ cfg=/etc/glance/glance-${service}.conf
|
||||
: ${ADMIN_TENANT_NAME:=admin}
|
||||
|
||||
if ! [ "$GLANCE_DB_PASSWORD" ]; then
|
||||
echo "*** Missing GLANCE_DB_PASSWORD" >&2
|
||||
exit 1
|
||||
echo "*** Missing GLANCE_DB_PASSWORD" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
crudini --del $cfg \
|
||||
@ -25,9 +25,9 @@ crudini --set $cfg \
|
||||
"${GLANCE_KEYSTONE_PASS}"
|
||||
|
||||
for option in auth_protocol auth_host auth_Port; do
|
||||
crudini --del $cfg \
|
||||
keystone_authtoken \
|
||||
$option
|
||||
crudini --del $cfg \
|
||||
keystone_authtoken \
|
||||
$option
|
||||
done
|
||||
|
||||
crudini --set $cfg
|
||||
@ -37,19 +37,18 @@ crudini --set $cfg
|
||||
crudini --set $cfg
|
||||
keystone_authtoken \
|
||||
admin_tenant_name \
|
||||
"${ADMIN_TENANT_NAME}"
|
||||
"${ADMIN_TENANT_NAME}"
|
||||
crudini --set $cfg
|
||||
keystone_authtoken \
|
||||
admin_user \
|
||||
"${GLANCE_KEYSTONE_USER}"
|
||||
"${GLANCE_KEYSTONE_USER}"
|
||||
crudini --set $cfg
|
||||
keystone_authtoken \
|
||||
admin_password \
|
||||
"${GLANCE_KEYSTONE_PASS}"
|
||||
|
||||
crudini --set $cfg \
|
||||
database \
|
||||
connection \
|
||||
"mysql://${GLANCE_DB_USER}:${GLANCE_DB_PASSWORD}@${MARIADBMASTER_PORT_3306_TCP_ADDR}:${MARIADBMASTER_PORT_3306_TCP_PORT}/${GLANCE_DB_NAME}"
|
||||
|
||||
database \
|
||||
connection \
|
||||
"mysql://${GLANCE_DB_USER}:${GLANCE_DB_PASSWORD}@${MARIADBMASTER_PORT_3306_TCP_ADDR}:${MARIADBMASTER_PORT_3306_TCP_PORT}/${GLANCE_DB_NAME}"
|
||||
|
||||
|
@ -4,37 +4,38 @@
|
||||
: ${GLANCE_DB_NAME:=glance}
|
||||
: ${KEYSTONE_AUTH_PROTOCOL:=http}
|
||||
: ${GLANCE_KEYSTONE_USER:=glance}
|
||||
: ${ADMIN_TENANT_NAME:=admin}
|
||||
: ${GLANCE_TENANT_NAME:=services}
|
||||
|
||||
if ! [ "$KEYSTONE_ADMIN_TOKEN" ]; then
|
||||
echo "*** Missing KEYSTONE_ADMIN_TOKEN" >&2
|
||||
exit 1
|
||||
echo "*** Missing KEYSTONE_ADMIN_TOKEN" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [ "$DB_ROOT_PASSWORD" ]; then
|
||||
echo "*** Missing DB_ROOT_PASSWORD" >&2
|
||||
exit 1
|
||||
echo "*** Missing DB_ROOT_PASSWORD" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [ "$GLANCE_DB_PASSWORD" ]; then
|
||||
GLANCE_DB_PASSWORD=$(openssl rand -hex 15)
|
||||
export GLANCE_DB_PASSWORD
|
||||
GLANCE_DB_PASSWORD=$(openssl rand -hex 15)
|
||||
export GLANCE_DB_PASSWORD
|
||||
fi
|
||||
|
||||
sh /opt/glance/config-glance.sh registry
|
||||
|
||||
mysql -h ${MARIADBMASTER_PORT_3306_TCP_ADDR} -u root \
|
||||
-p${DB_ROOT_PASSWORD} mysql <<EOF
|
||||
CREATE DATABASE IF NOT EXISTS ${GLANCE_DB_NAME};
|
||||
GRANT ALL PRIVILEGES ON glance* TO
|
||||
'${GLANCE_DB_USER}'@'%' IDENTIFIED BY '${GLANCE_DB_PASSWORD}'
|
||||
mysql -h ${MARIADBMASTER_PORT_3306_TCP_ADDR} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF
|
||||
CREATE DATABASE IF NOT EXISTS ${GLANCE_DB_NAME} DEFAULT CHARACTER SET utf8;
|
||||
GRANT ALL PRIVILEGES ON ${GLANCE_DB_NAME}.* TO
|
||||
'${GLANCE_DB_USER}'@'%' IDENTIFIED BY '${GLANCE_DB_PASSWORD}'
|
||||
|
||||
EOF
|
||||
|
||||
/usr/bin/glance-manage db_sync
|
||||
|
||||
export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}"
|
||||
export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONEMASTER_35357_PORT_35357_TCP_ADDR}:35357/v2.0"
|
||||
|
||||
/bin/keystone user-create --name ${GLANCE_KEYSTONE_USER} --pass ${GLANCE_ADMIN_PASSWORD}
|
||||
/bin/keystone role-create --name ${GLANCE_KEYSTONE_USER}
|
||||
/bin/keystone user-role-add --user ${GLANCE_KEYSTONE_USER} --role admin --tenant ${ADMIN_TENANT_NAME}
|
||||
/usr/bin/keystone user-create --name ${GLANCE_KEYSTONE_USER} --pass ${GLANCE_KEYSTONE_PASS}
|
||||
/usr/bin/keystone user-role-add --user ${GLANCE_KEYSTONE_USER} --role admin --tenant ${GLANCE_TENANT_NAME}
|
||||
|
||||
exec /usr/bin/glance-registry
|
||||
|
Loading…
Reference in New Issue
Block a user