bin/initialize_overcloud.sh in egon-0.4.8 vs bin/initialize_overcloud.sh in egon-1.0.0

- old
+ new

@@ -1,19 +1,58 @@ #!/bin/bash +OVERCLOUD_NAME=${1:-overcloud} +TEMPLATE_DIR=`mktemp -d` +DEFAULT_PARAMETERS=overcloud-resource-registry-puppet.yaml +USER_PARAMETERS=environments/deployment_parameters.yaml + source /home/stack/stackrc -source /home/stack/tripleo-overcloud-passwords -KEYSTONE_IP=`heat output-show overcloud KeystoneAdminVip | tr -d '"'` -PUBLIC_IP=`heat output-show overcloud PublicVip | tr -d '"'` -OVERCLOUD_ENDPOINT=`heat output-show overcloud KeystoneURL` -OVERCLOUD_IP=`python -c "from six.moves.urllib.parse import urlparse; print urlparse($OVERCLOUD_ENDPOINT).hostname"` -OVERCLOUD_ENDPOINT=`echo $OVERCLOUD_ENDPOINT | tr -d '"'` +cd $TEMPLATE_DIR +swift download overcloud $DEFAULT_PARAMETERS +swift download overcloud $USER_PARAMETERS +function parameter_value_from_file { + PARAM=$1 + FILE=$2 + PARAM_GREP="^ ${PARAM}: " + PARAM_VALUE_UNPARSED=`grep "$PARAM_GREP" $FILE` + PARAM_VALUE=${PARAM_VALUE_UNPARSED#*:} + echo $PARAM_VALUE +} + +function parameter_value { + PARAM=$1 + PARAM_VALUE=`parameter_value_from_file $PARAM $TEMPLATE_DIR/$USER_PARAMETERS` + + if [ -z "$PARAM_VALUE" ]; then + PARAM_VALUE=`parameter_value_from_file $PARAM $TEMPLATE_DIR/$DEFAULT_PARAMETERS` + fi + + echo $PARAM_VALUE +} + +KEYSTONE_IP=`heat output-show $OVERCLOUD_NAME KeystoneAdminVip | tr -d '"'` +PUBLIC_IP=`heat output-show $OVERCLOUD_NAME PublicVip | tr -d '"'` +KEYSTONE_URL=`heat output-show $OVERCLOUD_NAME KeystoneURL` +OVERCLOUD_IP=`python -c "from six.moves.urllib.parse import urlparse; print urlparse($KEYSTONE_URL).hostname"` +OVERCLOUD_ENDPOINT=`echo $KEYSTONE_URL | tr -d '"'` + # set it to the same as overcloud_ip if empty [ -z "$KEYSTONE_IP" ] && KEYSTONE_IP=$OVERCLOUD_IP +# get service passwords +OVERCLOUD_ADMIN_PASSWORD=`parameter_value AdminPassword` +OVERCLOUD_ADMIN_TOKEN=`parameter_value AdminToken` +OVERCLOUD_CEILOMETER_PASSWORD=`parameter_value CeilometerPassword` +OVERCLOUD_CINDER_PASSWORD=`parameter_value CinderPassword` +OVERCLOUD_GLANCE_PASSWORD=`parameter_value GlancePassword` +OVERCLOUD_HEAT_PASSWORD=`parameter_value HeatPassword` +OVERCLOUD_NEUTRON_PASSWORD=`parameter_value NeutronPassword` +OVERCLOUD_NOVA_PASSWORD=`parameter_value NovaPassword` +OVERCLOUD_SWIFT_PASSWORD=`parameter_value SwiftPassword` + # Write overcloudrc su - stack -c cat > /home/stack/overcloudrc << EOF export NOVA_VERSION=1.1 export COMPUTE_API_VERSION=1.1 export OS_USERNAME=admin @@ -48,11 +87,10 @@ "ec2": {"password": "$OVERCLOUD_GLANCE_PASSWORD"}, "glance": {"password": "$OVERCLOUD_GLANCE_PASSWORD"}, "heat": {"password": "$OVERCLOUD_HEAT_PASSWORD"}, "neutron": {"password": "$OVERCLOUD_NEUTRON_PASSWORD"}, "nova": {"password": "$OVERCLOUD_NOVA_PASSWORD"}, - "novav3": {"password": "$OVERCLOUD_NOVA_PASSWORD"}, "swift": {"password": "$OVERCLOUD_SWIFT_PASSWORD"}, "horizon": { "port": "80", "path": "/dashboard/", "admin_path": "/dashboard/admin" @@ -60,6 +98,9 @@ } EOF # set up the endpoints setup-endpoints -s $ENDPOINTS_FILE -r regionOne + +# cleanup rm -f $ENDPOINTS_FILE +rm -rf $TEMPLATE_DIR