Merge "[aiab] Allow to run aiab deployment from any directory"

This commit is contained in:
Zuul 2019-06-14 17:30:24 +00:00 committed by Gerrit Code Review
commit 2e67179721
3 changed files with 25 additions and 24 deletions

View File

@ -22,6 +22,8 @@
# #
###############################################################################
AIAB_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
usage ()
{
echo "Usage: $(basename $0) {-y|-h}" 1>&2
@ -148,7 +150,7 @@ get_dns_servers ()
if grep -q "10.96.0.10" "/etc/resolv.conf"; then
echo "Not changing DNS servers, /etc/resolv.conf already updated."
else
DNS_CONFIG_FILE="../../../../site/${TARGET_SITE}/networks/common-addresses.yaml"
DNS_CONFIG_FILE="${AIAB_DIR}/../../../site/${TARGET_SITE}/networks/common-addresses.yaml"
declare -a DNS_SERVERS=($(get_dns_servers))
NS1=${DNS_SERVERS[0]:-8.8.8.8}
NS2=${DNS_SERVERS[1]:-$NS1}
@ -160,4 +162,4 @@ fi
echo ""
echo "Starting Airship deployment..."
sleep 1
common/deploy-airship.sh demo
${AIAB_DIR}/common/deploy-airship.sh demo

View File

@ -24,11 +24,6 @@
set -x
# IMPORTANT:
# If the directory for airship-in-a-bottle is already cloned into $WORKSPACE,
# it will not be re-cloned. This can be used to set up different tests, like
# changing the versions and contents of the design before running this script
# The last step to run through in this script. Valid Values are "collect",
# "genesis", "deploy", and "demo". By default this will run through to the end
# of the genesis steps
@ -46,8 +41,12 @@ else
STEP_BREAKPOINT=20
fi
# The directory that will contain the copies of designs and repos from this script
export WORKSPACE=${WORKSPACE:-"/root/deploy"}
# The directory of the repo where current script is located.
REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../../../../ >/dev/null 2>&1 && pwd )"
# The directory that will contain the copies of designs and repos from this
# script. By default it is a directory where the repository is cloned.
export WORKSPACE=${WORKSPACE:-"${REPO_DIR}/../"}
# The site to deploy
TARGET_SITE=${TARGET_SITE:-"aiab"}
@ -68,9 +67,6 @@ NODE_NET_IFACE=${NODE_NET_IFACE:-""}
# Allowance for Genesis/Armada to settle in seconds:
POST_GENESIS_DELAY=${POST_GENESIS_DELAY:-60}
# The directory of the repo where current script is located.
REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../../../../ >/dev/null 2>&1 && pwd )"
# Command shortcuts
PEGLEG="${REPO_DIR}/tools/airship pegleg"
SHIPYARD="${REPO_DIR}/tools/airship shipyard"
@ -306,7 +302,7 @@ function execute_create_heat_stack() {
echo " "
set -x
# Switch to directory where the script is located
pushd ${WORKSPACE}/treasuremap/tools/deployment/aiab/
pushd ${WORKSPACE}/treasuremap/tools/deployment/aiab/common/
bash test_create_heat_stack.sh
popd
}
@ -332,9 +328,9 @@ function print_dashboards() {
echo " Username: admin"
echo " Password: password"
echo " "
echo "OpenStack CLI commands could be launched via \`./run_openstack_cli.sh\` script, e.g.:"
echo " # cd ${WORKSPACE}/treasuremap/tools/deployment/aiab"
echo " # ./run_openstack_cli.sh stack list"
echo "OpenStack CLI commands could be launched via \`./openstack\` script, e.g.:"
echo " # cd ${WORKSPACE}/treasuremap/tools/"
echo " # ./openstack stack list"
echo " ..."
echo " "
echo "Other dashboards:"

View File

@ -15,6 +15,9 @@
set -e
AIAB_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" >/dev/null 2>&1 && pwd )"
OPENSTACK="${AIAB_DIR}/../../openstack"
# External subnet is local to the environment and generally can be anything
# other then clash with default all-in-one OSH setup that uses 127.24.4.0/24
export OSH_BR_EX_ADDR="172.24.8.1/24"
@ -23,18 +26,17 @@ export OSH_EXT_SUBNET="172.24.8.0/24"
# Install curl if it's not already installed
apt -y install --no-install-recommends curl
cp /root/deploy/treasuremap/tools/openstack /root/deploy/treasuremap/tools/deployment/aiab
cd /root/deploy/treasuremap/tools/deployment/aiab
pushd "${AIAB_DIR}"
printf "\nCreating KeyPair\n"
./openstack keypair create heat-vm-key > id_rsa
${OPENSTACK} keypair create heat-vm-key > id_rsa
chmod 600 id_rsa
printf "Downloading heat-public-net-deployment.yaml\n"
curl -LO https://raw.githubusercontent.com/openstack/openstack-helm/master/tools/gate/files/heat-public-net-deployment.yaml
printf "Creating public-net Heat Stack\n"
./openstack stack create --wait \
${OPENSTACK} stack create --wait \
--parameter subnet_cidr=${OSH_EXT_SUBNET} \
--parameter subnet_gateway=${OSH_BR_EX_ADDR%/*} \
-t /target/heat-public-net-deployment.yaml \
@ -44,15 +46,16 @@ printf "Downloading heat-basic-vm-deployment.yaml\n"
curl -LO https://raw.githubusercontent.com/openstack/openstack-helm/master/tools/gate/files/heat-basic-vm-deployment.yaml
printf "Creating test-stack-01\n"
./openstack stack create -t /target/heat-basic-vm-deployment.yaml test-stack-01 --wait
${OPENSTACK} stack create -t /target/heat-basic-vm-deployment.yaml test-stack-01 --wait
popd
printf "Heat Stack List\n"
./openstack stack list
${OPENSTACK} stack list
printf "Nova Server List\n"
./openstack server list
${OPENSTACK} server list
FLOATING_IP=$(./openstack stack output show \
FLOATING_IP=$(${OPENSTACK} stack output show \
test-stack-01 \
floating_ip \
-f value -c output_value)