From c5f1e497ceb8fe5f03cc35ea40c480441c8e0c45 Mon Sep 17 00:00:00 2001 From: blsaws Date: Sun, 22 May 2016 16:13:36 -0700 Subject: Align ubuntu and centos scripts, simplify CLI test setup JIRA: COPPER-4 Change-Id: I6dbfee6bdbd3c070e53ed6d5e1e8bc9d2e0da155 Signed-off-by: blsaws --- .../test-webapp/setup/clean_congress_testserver.sh | 34 +++--- .../setup/install_congress_cli_test_environment.sh | 120 ++++----------------- .../setup/install_congress_testserver.sh | 40 +++++-- 3 files changed, 62 insertions(+), 132 deletions(-) diff --git a/components/congress/test-webapp/setup/clean_congress_testserver.sh b/components/congress/test-webapp/setup/clean_congress_testserver.sh index 4376edc..4148751 100755 --- a/components/congress/test-webapp/setup/clean_congress_testserver.sh +++ b/components/congress/test-webapp/setup/clean_congress_testserver.sh @@ -14,25 +14,19 @@ # limitations under the License. # # This is a cleanup script for installation of the Congress testserver -# on an Ubuntu 14.04 LXC container in the jumphost. -# Presumably something has failed, and any record of the testserver -# needs to be removed, so you can try the install again. +# as installed under JOID or Apex (Fuel and Compass not yet verified). +# Prequisite: OPFNV installed per JOID or Apex installer # On jumphost: -# source ~/clean_congress_testserver.sh -# indicates whether to turn on command echoing - -source ~/admin-openrc.sh <&2 "$0: specify both copper-branch and openstack-branch" - set +x - return 2 -fi -if [ $# -eq 2 ]; then - cubranch=$1 - osbranch=$2 -fi +if [ $# -eq 1 ]; then cubranch=$1; fi -cubranch=$1 -osbranch=$2 - -echo "Install prerequisites" +echo "Copy environment files to /tmp/copper" +if [ ! -d /tmp/copper ]; then mkdir /tmp/copper; fi dist=`grep DISTRIB_ID /etc/*-release | awk -F '=' '{print $2}'` - if [ "$dist" == "Ubuntu" ]; then - echo "Update the base server" - set -x - sudo apt-get update - #apt-get -y upgrade - echo "Install pip" - sudo apt-get install -y python-pip - echo "Install java" - sudo apt-get install -y default-jre - echo "Install other dependencies" - apt-get install -y git gcc python-dev libxml2 libxslt1-dev libzip-dev php5-curl + cp ~/congress/env.sh /tmp/copper/ + cp ~/congress/admin-openrc.sh /tmp/copper/ else - echo "Add epel repo" - sudo yum install epel-release -y - echo "install pip" - sudo yum install python-pip -y - echo "install other dependencies" - sudo yum install apg git gcc libxml2 python-devel libzip-devel libxslt-devel -y + echo "Copy copper environment files" + sudo scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no stack@192.0.2.1:/home/stack/congress/*.sh /tmp/copper fi -echo "Install python dependencies" -sudo pip install --upgrade pip virtualenv setuptools pbr tox - -echo "Create virtualenv" -mkdir /tmp/copper -cd /tmp/copper -virtualenv venv -source venv/bin/activate - echo "Clone copper" -git clone https://gerrit.opnfv.org/gerrit/copper -cd copper -if [ $# -eq 2 ]; then git checkout $1; fi - -echo "Setup OpenStack environment variables per your OPNFV install" -source env.sh -source admin-openrc.sh - -echo "Clone congress" -git clone https://github.com/openstack/congress.git -cd congress -if [ $# -eq 2 ]; then git checkout $2; fi - -echo "Install OpenStack client" -cd /tmp/copper -git clone https://github.com/openstack/python-openstackclient.git -cd python-openstackclient -if [ $# -eq 2 ]; then git checkout $2; fi -pip install -r requirements.txt -pip install . - -echo "Install Congress client" -cd /tmp/copper -git clone https://github.com/openstack/python-congressclient.git -cd python-congressclient -if [ $# -eq 2 ]; then git checkout $2; fi -pip install -r requirements.txt -pip install . - -echo "Install Glance client" -cd /tmp/copper -git clone https://github.com/openstack/python-glanceclient.git -cd python-glanceclient -if [ $# -eq 2 ]; then git checkout $2; fi -pip install -r requirements.txt -pip install . - -echo "Install Neutron client" -cd /tmp/copper -git clone https://github.com/openstack/python-neutronclient.git -cd python-neutronclient -if [ $# -eq 2 ]; then git checkout $2; fi -pip install -r requirements.txt -pip install . - -echo "Install Nova client" -cd /tmp/copper -git clone https://github.com/openstack/python-novaclient.git -cd python-novaclient -if [ $# -eq 2 ]; then git checkout $2; fi -pip install -r requirements.txt -pip install . - -echo "Install Keystone client" -cd /tmp/copper -git clone https://github.com/openstack/python-keystoneclient.git -cd python-keystoneclient -if [ $# -eq 2 ]; then git checkout $2; fi -pip install -r requirements.txt -pip install . +if [ ! -d /tmp/copper/copper ]; then + cd /tmp/copper + git clone https://gerrit.opnfv.org/gerrit/copper + cd copper + if [ $# -eq 1 ]; then git checkout $1; fi +else + echo "/tmp/copper exists: run 'rm -rf /tmp/copper' to start clean if needed" +fi cd /tmp/copper/copper/tests ls diff --git a/components/congress/test-webapp/setup/install_congress_testserver.sh b/components/congress/test-webapp/setup/install_congress_testserver.sh index ce89faf..a513929 100644 --- a/components/congress/test-webapp/setup/install_congress_testserver.sh +++ b/components/congress/test-webapp/setup/install_congress_testserver.sh @@ -24,7 +24,7 @@ # How to use: # Retrieve the copper install script as below, optionally specifying the # branch to use as a URL parameter, e.g. ?h=stable%2Fbrahmaputra -# $ wget https://git.opnfv.org/cgit/copper/tree/components/congress/test-webapp/setup/install_congress_testserver.sh +# $ wget https://git.opnfv.org/cgit/copper/plain/components/congress/test-webapp/setup/install_congress_testserver.sh # $ source install_congress_testserver.sh [copper-branch] # optionally specifying the branch identifier to use for copper @@ -36,9 +36,22 @@ echo "Install prerequisites" dist=`grep DISTRIB_ID /etc/*-release | awk -F '=' '{print $2}'` if [ "$dist" == "Ubuntu" ]; then - sudo apt-get install -y docker - cp env.sh /tmp/copper/ - cp admin-openrc.sh /tmp/copper/ + # Docker setup procedure from https://docs.docker.com/engine/installation/linux/ubuntulinux/ + echo "Install docker and prerequisites" + sudo apt-get update + sudo apt-get install -y apt-transport-https ca-certificates + sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D + sudo tee /etc/apt/sources.list.d/docker.list <<- 'EOF' +deb https://apt.dockerproject.org/repo ubuntu-trusty main +EOF + sudo apt-get update + sudo apt-get purge lxc-docker + apt-cache policy docker-engine + sudo apt-get install -y linux-image-extra-$(uname -r) + sudo apt-get install -y docker docker-engine + echo "Copy copper environment files" + cp ~/congress/env.sh /tmp/copper/ + cp ~/congress/admin-openrc.sh /tmp/copper/ else sudo tee /etc/yum.repos.d/docker.repo <<-'EOF' [dockerrepo] @@ -48,19 +61,26 @@ enabled=1 gpgcheck=1 gpgkey=https://yum.dockerproject.org/gpg EOF + echo "Copy copper environment files" sudo scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no stack@192.0.2.1:/home/stack/congress/*.sh /tmp/copper fi echo "Clone copper" -if [ ! -d /tmp/copper ]; then mkdir /tmp/copper; fi -cd /tmp/copper -if [ -d copper ]; then rm -rf copper -git clone https://gerrit.opnfv.org/gerrit/copper; fi -cd copper -if [ $# -eq 1 ]; then git checkout $1; fi +if [ ! -d /tmp/copper ]; then + mkdir /tmp/copper + cd /tmp/copper + git clone https://gerrit.opnfv.org/gerrit/copper + cd copper + if [ $# -eq 1 ]; then git checkout $1; fi +else + echo "/tmp/copper exists: run 'rm -rf /tmp/copper' to start clean if needed" +fi sudo service docker start +echo "Setup copper environment" +source /tmp/copper/env.sh + echo "Setup webapp files" if [ ! -d /tmp/copper/log ]; then mkdir /tmp/copper/log; fi source /tmp/copper/env.sh -- cgit 1.2.3-korg