Authentication fails by keystonemiddleware

In order to make the access to Smaug by APIs pass througth the
authentication of keystonemiddleware, I add a function named
"create_smaug_accounts" in the plugin.sh, which will create an
account in Keystone.

There are 4 steps in "create_smaug_accounts":
1. create a user "smaug".
2. bind the user with the project "service" and grant the role
   "service" to the user.
3. create a service "smaug".
4. create an endpoint of service.

Closes-Bug: #1526638
Change-Id:  I7644e568a8912f48e54b15cf897afe67a81c2e4a
This commit is contained in:
zengchen 2015-12-17 10:47:54 +08:00
parent cc883a2e24
commit cc5931e7e4
2 changed files with 26 additions and 1 deletions

View File

@ -16,6 +16,27 @@ function _create_smaug_conf_dir {
}
# create_smaug_accounts() - Set up common required smaug accounts
# Tenant User Roles
# ------------------------------------------------------------------
# service smaug service
function create_smaug_accounts {
if is_service_enabled smaug-api; then
create_service_user "smaug"
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
get_or_create_service "smaug" "data-protect" "Application Data Protection Service"
get_or_create_endpoint "data-protect" "$REGION_NAME" \
"$SMAUG_API_PROTOCOL://$SMAUG_API_HOST:$SMAUG_API_PORT/v1/\$(tenant_id)s" \
"$SMAUG_API_PROTOCOL://$SMAUG_API_HOST:$SMAUG_API_PORT/v1/\$(tenant_id)s" \
"$SMAUG_API_PROTOCOL://$SMAUG_API_HOST:$SMAUG_API_PORT/v1/\$(tenant_id)s"
fi
fi
}
function configure_smaug_api {
if is_service_enabled smaug-api ; then
echo "Configuring Smaug API"
@ -75,6 +96,10 @@ if [[ "$Q_ENABLE_SMAUG" == "True" ]]; then
echo export PYTHONPATH=\$PYTHONPATH:$SMAUG_DIR >> $RC_DIR/.localrc.auto
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
echo_summary "Creating Smaug entities for auth service"
create_smaug_accounts
echo_summary "Initializing Smaug Service"
SMAUG_BIN_DIR=$(get_python_exec_prefix)
if is_service_enabled smaug-api; then

View File

@ -12,7 +12,7 @@ SMAUG_API_CONF=$SMAUG_CONF_DIR/smaug.conf
SMAUG_API_LISTEN_ADDRESS=${SMAUG_API_LISTEN_ADDRESS:-0.0.0.0}
SMAUG_API_HOST=${SMAUG_API_HOST:-$SERVICE_HOST}
SMAUG_API_PORT=${SMAUG_API_PORT:-19999}
SMAUG_API_PORT=${SMAUG_API_PORT:-8799}
SMAUG_API_PROTOCOL=${SMAUG_API_PROTOCOL:-$SERVICE_PROTOCOL}
SMAUG_AUTH_CACHE_DIR=${SMAUG_AUTH_CACHE_DIR:-/var/cache/smaug}