training-guides/labs/scripts/config_tenant_network.sh
Roger Luethi c8f5ebb0e4 labs: fix neutron locale
The neutron client fails with an "unsupported locale setting" message if
a locale is sent via ssh from the host computer to the node VM.

This changeset works around the problem by setting LC_ALL=C if the
problem is detected.

Change-Id: I9caa38c8fbe7d0d0e4025e4ba0c7fb537e1686de
Implements: blueprint openstack-training-labs
2014-08-23 20:23:28 +02:00

44 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
TOP_DIR=$(cd $(dirname "$0")/.. && pwd)
source "$TOP_DIR/config/paths"
source "$CONFIG_DIR/credentials"
source "$LIB_DIR/functions.guest"
source "$CONFIG_DIR/demo-openstackrc.sh"
exec_logfile
indicate_current_auto
#------------------------------------------------------------------------------
#
#------------------------------------------------------------------------------
# Work around neutron client failing with unsupported locale settings
if [[ "$(neutron --help)" == "unsupported locale setting" ]]; then
echo "Locale not supported on node, setting LC_ALL=C."
export LC_ALL=C
fi
echo "Waiting for neutron to start."
until neutron net-list >/dev/null 2>&1; do
sleep 1
done
echo "Creating the tenant network."
neutron net-create demo-net
echo "Creating a subnet on the tenant network."
neutron subnet-create demo-net \
--name demo-subnet \
--gateway "$TENANT_NETWORK_GATEWAY" \
"$TENANT_NETWORK_CIDR"
echo "Creating a router on the tenant network."
neutron router-create demo-router
echo "Attaching the router to the demo tenant subnet."
neutron router-interface-add demo-router demo-subnet
echo "Attaching the router to the external network by setting it as the" \
"gateway."
neutron router-gateway-set demo-router ext-net