diff options
author | 2016-04-01 16:33:47 -0700 | |
---|---|---|
committer | 2016-04-01 16:33:47 -0700 | |
commit | 5c5a34a44b3d5677624e37e2666f7f2db7b81943 (patch) | |
tree | 5c169d45ca3ab0bab1434cdec1b8a4aae228983f | |
parent | e881d5e184e79cfe13126b2c5b3b216b56346a8b (diff) |
Add check for parameters; add echo statements
JIRA: COPPER-2
Change-Id: I031f4d13bc25c2b6c72cdd7ae3e64537532f7c6f
Signed-off-by: blsaws <bryan.sullivan@att.com>
-rw-r--r-- | components/congress/joid/install_congress_1.sh | 13 | ||||
-rw-r--r-- | components/congress/joid/install_congress_2.sh | 60 |
2 files changed, 37 insertions, 36 deletions
diff --git a/components/congress/joid/install_congress_1.sh b/components/congress/joid/install_congress_1.sh index 7bf45af..8c15076 100644 --- a/components/congress/joid/install_congress_1.sh +++ b/components/congress/joid/install_congress_1.sh @@ -27,19 +27,20 @@ if [ $# -lt 1 ]; then return 2 fi -set -x +if [ $1 == "debug" ]; then set -x #echo on +fi -# Create the congress container +echo "Create the congress container" juju ssh ubuntu@$1 "sudo lxc-clone -o juju-trusty-lxc-template -n juju-trusty-congress; sudo lxc-start -n juju-trusty-congress -d; exit" -# Get the congress server address +echo "Get the congress server address" CONGRESS_HOST="" while [ "$CONGRESS_HOST" == "" ]; do sleep 5 CONGRESS_HOST=$(juju ssh ubuntu@$1 "sudo lxc-info --name juju-trusty-congress | grep IP" | awk "/ / { print \$2 }" | tr -d '\r') done -# Create the environment file and copy to the congress server +echo "Create the environment file and copy to the congress server" cat <<EOF >~/env.sh export CONGRESS_HOST=$CONGRESS_HOST export KEYSTONE_HOST=$(juju status --format=short | awk "/keystone\/0/ { print \$3 }") @@ -53,8 +54,8 @@ source ~/env.sh juju scp ~/admin-openrc.sh ubuntu@$CONGRESS_HOST:/home/ubuntu juju scp ~/env.sh ubuntu@$CONGRESS_HOST:/home/ubuntu -# Copy the install script to the congress server and execute +echo "Copy the install script to the congress server and execute" juju scp ~/git/copper/components/congress/joid/install_congress_2.sh ubuntu@$CONGRESS_HOST:/home/ubuntu ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ubuntu@$CONGRESS_HOST "source ~/install_congress_2.sh; exit" -set +x +set +x #echo off diff --git a/components/congress/joid/install_congress_2.sh b/components/congress/joid/install_congress_2.sh index 5c9ebb9..d8b0968 100644 --- a/components/congress/joid/install_congress_2.sh +++ b/components/congress/joid/install_congress_2.sh @@ -29,39 +29,39 @@ openstack EOF source ~/env.sh -# Update package repos +echo "Update package repos" sudo apt-get update -# install pip +echo "install pip" sudo apt-get install python-pip -y -# install java +echo "install java" sudo apt-get install default-jre -y -# install other dependencies +echo "install other dependencies" sudo apt-get install apg git gcc python-dev libxml2 libxslt1-dev libzip-dev -y -# set mysql root user password and install mysql +echo "set mysql root user password and install mysql" export MYSQL_PASSWORD=$(/usr/bin/apg -n 1 -m 16 -c cl_seed) sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password '$MYSQL_PASSWORD sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password '$MYSQL_PASSWORD sudo -E apt-get -q -y install mysql-server python-mysqldb -# Clone congress +echo "Clone congress" mkdir ~/git cd ~/git git clone https://github.com/openstack/congress.git cd congress git checkout stable/liberty -# Install virtualenv +echo "Install virtualenv" sudo pip install virtualenv -# Create virtualenv +echo "Create virtualenv" virtualenv ~/git/congress source bin/activate -# Setup Congress +echo "Setup Congress" sudo mkdir -p /etc/congress sudo mkdir -p /etc/congress/snapshot sudo mkdir /var/log/congress @@ -69,23 +69,23 @@ sudo chown ubuntu /var/log/congress sudo cp etc/api-paste.ini /etc/congress sudo cp etc/policy.json /etc/congress -# install requirements.txt and tox dependencies (detected by errors during "tox -egenconfig") +echo "install requirements.txt and tox dependencies (detected by errors during 'tox -egenconfig')" sudo apt-get install libffi-dev -y sudo apt-get install openssl -y sudo apt-get install libssl-dev -y -# install dependencies of Congress +echo "install dependencies of Congress" cd ~/git/congress sudo pip install -r requirements.txt sudo pip install . -# install tox +echo "install tox" sudo pip install tox -# generate congress.conf.sample +echo "generate congress.conf.sample" sudo tox -egenconfig -# edit congress.conf.sample as needed +echo "edit congress.conf.sample as needed" sudo sed -i -- 's/#verbose = true/verbose = true/g' etc/congress.conf.sample sudo sed -i -- 's/#log_file = <None>/log_file = congress.log/g' etc/congress.conf.sample sudo sed -i -- 's/#log_dir = <None>/log_dir = \/var\/log\/congress/g' etc/congress.conf.sample @@ -101,20 +101,20 @@ sudo sed -i -- 's/#admin_user = <None>/admin_user = congress/g' etc/congress.con sudo sed -i -- 's/#admin_password = <None>/admin_password = congress/g' etc/congress.conf.sample sudo sed -i -- 's/#connection = <None>/connection = mysql:\/\/ubuntu:'$MYSQL_PASSWORD'@localhost:3306\/congress/g' etc/congress.conf.sample -# copy congress.conf.sample to /etc/congress +echo "copy congress.conf.sample to /etc/congress" sudo cp etc/congress.conf.sample /etc/congress/congress.conf -# create congress database +echo "create congress database" sudo mysql --user=root --password=$MYSQL_PASSWORD -e "CREATE DATABASE congress; GRANT ALL PRIVILEGES ON congress.* TO 'ubuntu@localhost' IDENTIFIED BY '"$MYSQL_PASSWORD"'; GRANT ALL PRIVILEGES ON congress.* TO 'ubuntu'@'%' IDENTIFIED BY '"$MYSQL_PASSWORD"'; exit;" -# install congress-db-manage dependencies (detected by errors) +echo "install congress-db-manage dependencies (detected by errors)" sudo apt-get build-dep python-mysqldb -y pip install MySQL-python -# create database schema +echo "create database schema" congress-db-manage --config-file /etc/congress/congress.conf upgrade head -# Install and test OpenStack client +echo "Install and test OpenStack client" cd ~/git git clone https://github.com/openstack/python-openstackclient.git cd python-openstackclient @@ -123,7 +123,7 @@ sudo pip install -r requirements.txt sudo pip install . openstack service list -# Install and test Congress client +echo "Install and test Congress client" cd ~/git git clone https://github.com/openstack/python-congressclient.git cd python-congressclient @@ -132,7 +132,7 @@ sudo pip install -r requirements.txt sudo pip install . openstack congress driver list -# Install and test Keystone client +echo "Install and test Keystone client" cd ~/git git clone https://github.com/openstack/python-keystoneclient.git cd python-keystoneclient @@ -140,7 +140,7 @@ git checkout stable/liberty sudo pip install -r requirements.txt sudo pip install . -# setup Congress user. TODO: needs update in http://congress.readthedocs.org/en/latest/readme.html#installing-congress +echo "setup Congress user. TODO: needs update in http://congress.readthedocs.org/en/latest/readme.html#installing-congress" pip install cliff --upgrade export ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }") export SERVICE_TENANT=$(openstack project list | awk "/ admin / { print \$2 }") @@ -148,25 +148,25 @@ openstack user create --password congress --project admin --email "congress@exam export CONGRESS_USER=$(openstack user list | awk "/ congress / { print \$2 }") openstack role add --user $CONGRESS_USER --project $SERVICE_TENANT $ADMIN_ROLE -# Create Congress service +echo "Create Congress service" openstack service create congress --type "policy" --description "Congress Service" export CONGRESS_SERVICE=$(openstack service list | awk "/ congress / { print \$2 }") -# Create Congress endpoint +echo "Create Congress endpoint" openstack endpoint create $CONGRESS_SERVICE \ --region $OS_REGION_NAME \ --publicurl http://$CONGRESS_HOST:1789/ \ --adminurl http://$CONGRESS_HOST:1789/ \ --internalurl http://$CONGRESS_HOST:1789/ -# Start the Congress service in the background +echo "Start the Congress service in the background" cd ~/git/congress sudo bin/congress-server & -# disown the process (so it keeps running if you get disconnected) +echo "disown the process (so it keeps running if you get disconnected)" disown -h %1 -# Create data sources +echo "Create data sources" # To remove datasources: openstack congress datasource delete <name> # Insert a delay here, as nova datasource seems to fail to get setup (server not ready?) sleep 10 @@ -201,8 +201,8 @@ openstack congress datasource create keystone "keystone" \ --config password=$OS_PASSWORD \ --config auth_url=http://$KEYSTONE_HOST:5000/v2.0 -# Run Congress Tempest Tests +echo "Run Congress Tempest Tests" cd ~/git/congress # tox -epy27 -set +x -return + +set +x #echo off |