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