kolla/docker/glance/glance-base/config-glance.sh
Steven Dake 858cdda3ec Use keystone authentication with Glance
Previously glance was not using keystone for authentication.  This resulted
in --is-public true failing when doing image-create.

Co-Authored-By: Lars Stedman (larsks@redhat.com)

Change-Id: I54273115242ee169201643fe0ad559392650c883
2015-03-19 09:21:48 -07:00

64 lines
1.5 KiB
Bash

#!/bin/sh
set -e
. /opt/kolla/kolla-common.sh
: ${ADMIN_TENANT_NAME:=admin}
: ${GLANCE_DB_NAME:=glance}
: ${GLANCE_DB_USER:=glance}
: ${GLANCE_KEYSTONE_USER:=glance}
: ${KEYSTONE_AUTH_PROTOCOL:=http}
: ${PUBLIC_IP:=$GLANCE_API_PORT_9292_TCP_ADDR}
check_required_vars GLANCE_DB_PASSWORD GLANCE_KEYSTONE_PASSWORD
dump_vars
cat > /openrc <<EOF
export OS_AUTH_URL="http://${KEYSTONE_PUBLIC_SERVICE_HOST}:5000/v2.0"
export OS_USERNAME="${GLANCE_KEYSTONE_USER}"
export OS_PASSWORD="${GLANCE_KEYSTONE_PASSWORD}"
export OS_TENANT_NAME="${ADMIN_TENANT_NAME}"
EOF
for cfg in /etc/glance/glance-api.conf /etc/glance/glance-registry.conf; do
crudini --set $cfg \
DEFAULT \
log_file \
""
for option in auth_protocol auth_host auth_port; do
crudini --del $cfg \
keystone_authtoken \
$option
done
crudini --set $cfg \
keystone_authtoken \
auth_uri \
"http://${KEYSTONE_PUBLIC_SERVICE_HOST}:5000/"
crudini --set $cfg \
keystone_authtoken \
admin_tenant_name \
"${ADMIN_TENANT_NAME}"
crudini --set $cfg \
keystone_authtoken \
admin_user \
"${GLANCE_KEYSTONE_USER}"
crudini --set $cfg \
keystone_authtoken \
admin_password \
"${GLANCE_KEYSTONE_PASSWORD}"
crudini --set $cfg \
paste_deploy \
flavor \
keystone
crudini --set $cfg \
database \
connection \
"mysql://${GLANCE_DB_USER}:${GLANCE_DB_PASSWORD}@${MARIADB_SERVICE_HOST}/${GLANCE_DB_NAME}"
done