Extract writing clouds.yaml to function

It's a bit wordy to be directly in stack.sh and not in a function.

Change-Id: Ibddfd8018d861191f1b1dc3270e0e81c274733cd
This commit is contained in:
Monty Taylor 2015-09-19 11:26:18 -04:00
parent 16a2d64f37
commit 7224eecb98
2 changed files with 41 additions and 36 deletions

View File

@ -67,6 +67,45 @@ function save_stackenv {
done
}
# Update/create user clouds.yaml file.
# clouds.yaml will have
# - A `devstack` entry for the `demo` user for the `demo` project.
# - A `devstack-admin` entry for the `admin` user for the `admin` project.
# write_clouds_yaml
function write_clouds_yaml {
# The location is a variable to allow for easier refactoring later to make it
# overridable. There is currently no usecase where doing so makes sense, so
# it's not currently configurable.
CLOUDS_YAML=~/.config/openstack/clouds.yaml
mkdir -p $(dirname $CLOUDS_YAML)
CA_CERT_ARG=''
if [ -f "$SSL_BUNDLE_FILE" ]; then
CA_CERT_ARG="--os-cacert $SSL_BUNDLE_FILE"
fi
$TOP_DIR/tools/update_clouds_yaml.py \
--file $CLOUDS_YAML \
--os-cloud devstack \
--os-region-name $REGION_NAME \
--os-identity-api-version $IDENTITY_API_VERSION \
$CA_CERT_ARG \
--os-auth-url $KEYSTONE_AUTH_URI/v$IDENTITY_API_VERSION \
--os-username demo \
--os-password $ADMIN_PASSWORD \
--os-project-name demo
$TOP_DIR/tools/update_clouds_yaml.py \
--file $CLOUDS_YAML \
--os-cloud devstack-admin \
--os-region-name $REGION_NAME \
--os-identity-api-version $IDENTITY_API_VERSION \
$CA_CERT_ARG \
--os-auth-url $KEYSTONE_AUTH_URI/v$IDENTITY_API_VERSION \
--os-username admin \
--os-password $ADMIN_PASSWORD \
--os-project-name admin
}
# Normalize config values to True or False
# Accepts as False: 0 no No NO false False FALSE
# Accepts as True: 1 yes Yes YES true True TRUE

View File

@ -1064,42 +1064,8 @@ fi
# Save some values we generated for later use
save_stackenv
# Update/create user clouds.yaml file.
# clouds.yaml will have
# - A `devstack` entry for the `demo` user for the `demo` project.
# - A `devstack-admin` entry for the `admin` user for the `admin` project.
# The location is a variable to allow for easier refactoring later to make it
# overridable. There is currently no usecase where doing so makes sense, so
# it's not currently configurable.
CLOUDS_YAML=~/.config/openstack/clouds.yaml
mkdir -p $(dirname $CLOUDS_YAML)
CA_CERT_ARG=''
if [ -f "$SSL_BUNDLE_FILE" ]; then
CA_CERT_ARG="--os-cacert $SSL_BUNDLE_FILE"
fi
$TOP_DIR/tools/update_clouds_yaml.py \
--file $CLOUDS_YAML \
--os-cloud devstack \
--os-region-name $REGION_NAME \
--os-identity-api-version $IDENTITY_API_VERSION \
$CA_CERT_ARG \
--os-auth-url $KEYSTONE_AUTH_URI/v$IDENTITY_API_VERSION \
--os-username demo \
--os-password $ADMIN_PASSWORD \
--os-project-name demo
$TOP_DIR/tools/update_clouds_yaml.py \
--file $CLOUDS_YAML \
--os-cloud devstack-admin \
--os-region-name $REGION_NAME \
--os-identity-api-version $IDENTITY_API_VERSION \
$CA_CERT_ARG \
--os-auth-url $KEYSTONE_AUTH_URI/v$IDENTITY_API_VERSION \
--os-username admin \
--os-password $ADMIN_PASSWORD \
--os-project-name admin
# Write a clouds.yaml file
write_clouds_yaml
# Horizon
# -------