summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuo Ruijing <ruijing.guo@intel.com>2017-10-18 19:56:15 -0400
committerNarinder Gupta <narinder.gupta@canonical.com>2017-12-13 16:36:50 +0000
commitd27608283966794e0b93cd9ce12412f6ab8d16e4 (patch)
tree3901bc662f47e6ada1cc335322edddcb0bd9fbf2
parent06afa960e508c999b9dd96488c1aef01f222fba0 (diff)
cleanup code
1. remove unused code due to juju>2 & maas>2.2 in Ubuntu16.04 2. remove deprecated 03-maasdeploy.sh 3. remove other unused code Change-Id: I20fd0e96400db1262b0df3ef2b502c8001dd5b76 Signed-off-by: Guo Ruijing <ruijing.guo@intel.com> (cherry picked from commit 2819ba063c1a9896ccf437f85ca4c2ee463d7e80)
l---------ci/00-maasdeploy.sh1
-rwxr-xr-xci/01-bootstrap.sh21
-rwxr-xr-xci/02-deploybundle.sh22
-rwxr-xr-xci/03-maasdeploy.sh20
-rwxr-xr-xci/clean.sh62
-rwxr-xr-xci/cleanmaas.sh10
-rw-r--r--ci/depMAAS.py9
-rwxr-xr-xci/deploy.sh15
-rw-r--r--ci/genBundle.py8
-rw-r--r--ci/genDeploymentConfig.py9
-rw-r--r--ci/genK8Bundle.py3
-rw-r--r--ci/genMAASConfig.py9
-rwxr-xr-xci/openstack.sh32
13 files changed, 40 insertions, 181 deletions
diff --git a/ci/00-maasdeploy.sh b/ci/00-maasdeploy.sh
deleted file mode 120000
index 33b6f4d..0000000
--- a/ci/00-maasdeploy.sh
+++ /dev/null
@@ -1 +0,0 @@
-03-maasdeploy.sh \ No newline at end of file
diff --git a/ci/01-bootstrap.sh b/ci/01-bootstrap.sh
index 88f87dd..e45c2ee 100755
--- a/ci/01-bootstrap.sh
+++ b/ci/01-bootstrap.sh
@@ -2,21 +2,6 @@
set -ex
-#export JUJU_DEV_FEATURE_FLAGS=address-allocation
-
-jujuver=`juju --version`
-
-if [[ "$jujuver" < "2" ]]; then
- juju bootstrap --debug --to bootstrap.maas --agent-version 1.25.5
- sleep 5
- #disable juju gui until xenial charms are in charm store.
- juju deploy cs:juju-gui-130 --to 0
-
- JUJU_REPOSITORY=
- juju set-constraints tags=
-
-else
- controllername=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml`
- cloudname=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml`
- juju bootstrap $controllername $cloudname --debug --to bootstrap.maas
-fi
+controllername=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml`
+cloudname=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml`
+juju bootstrap $controllername $cloudname --debug --to bootstrap.maas
diff --git a/ci/02-deploybundle.sh b/ci/02-deploybundle.sh
index 2eff3f0..edfd133 100755
--- a/ci/02-deploybundle.sh
+++ b/ci/02-deploybundle.sh
@@ -12,9 +12,6 @@ opnfvfeature=$5
opnfvdistro=$6
opnfvmodel=$7
-jujuver=`juju --version`
-maasver=`apt-cache policy maas | grep Installed | cut -d ':' -f 2 | sed -e 's/ //'`
-
if [[ "$opnfvmodel" = "openstack" ]]; then
#copy and download charms
./$opnfvsdn/fetch-charms.sh $opnfvdistro
@@ -54,19 +51,10 @@ check_status() {
PROFILE=maas
MAAS_IP=$(grep " ip_address" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //')
API_SERVERMAAS="http://$MAAS_IP:5240/MAAS/"
-if [[ "$maasver" > "2" ]]; then
- API_KEY=`sudo maas-region apikey --username=ubuntu || true`
-else
- API_KEY=`sudo maas-region-admin apikey --username=ubuntu || true`
-fi
-
+API_KEY=`sudo maas-region apikey --username=ubuntu || true`
if [[ "$API_KEY" = "" ]]; then
- if [[ "$maasver" > "2" ]]; then
- API_KEY=`sshpass -p ubuntu ssh ubuntu@$MAAS_IP 'sudo maas-region apikey --username=ubuntu'`
- else
- API_KEY=`sshpass -p ubuntu ssh ubuntu@$MAAS_IP 'sudo maas-region-admin apikey --username=ubuntu'`
- fi
+ API_KEY=`sshpass -p ubuntu ssh ubuntu@$MAAS_IP 'sudo maas-region apikey --username=ubuntu'`
fi
maas login $PROFILE $API_SERVERMAAS $API_KEY
@@ -80,11 +68,7 @@ if [[ "$opnfvmodel" = "openstack" ]]; then
osdomname=`grep "os-domain-name" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //'`
fi
- if [[ "$maasver" > "2" ]]; then
- workmutiple=`maas maas nodes read | grep "cpu_count" | cut -d ':' -f 2 | sed -e 's/ //' | tr ',' ' '`
- else
- workmutiple=`maas maas nodes list | grep "cpu_count" | cut -d ':' -f 2 | sed -e 's/ //' | tr ',' ' '`
- fi
+ workmutiple=`maas maas nodes read | grep "cpu_count" | cut -d ':' -f 2 | sed -e 's/ //' | tr ',' ' '`
max=0
for v in ${workmutiple[@]}; do
if (( $v > $max )); then max=$v; fi;
diff --git a/ci/03-maasdeploy.sh b/ci/03-maasdeploy.sh
index 668eab9..3e5e237 100755
--- a/ci/03-maasdeploy.sh
+++ b/ci/03-maasdeploy.sh
@@ -56,10 +56,6 @@ sudo apt-get install bridge-utils openssh-server bzr git virtinst qemu-kvm libvi
python-congressclient gsutil charm-tools pastebinit python-jinja2 sshpass \
openssh-server vlan ipmitool jq expect snap -y
-#sudo apt-get install snap -y
-#sudo snap install maas --classic
-#sudo snap install juju --classic
-
sudo -H pip install --upgrade pip
@@ -222,14 +218,6 @@ sudo cat ~maas/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
sudo cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
#
-# MAAS deploy
-#
-
-installmaas(){
- sudo apt-get install maas maas-region-controller -y
-}
-
-#
# MAAS config
# https://insights.ubuntu.com/2016/01/23/maas-setup-deploying-openstack-on-maas-1-9-with-juju/
# http://blog.naydenov.net/2016/01/nodes-networking-deploying-openstack-on-maas-1-9-with-juju/
@@ -686,12 +674,8 @@ if [ -e ./labconfig.json ]; then
fi
# Add the cloud and controller credentials for MAAS for that lab.
-jujuver=`juju --version`
-
-if [[ "$jujuver" > "2" ]]; then
- addcloud
- addcredential
-fi
+addcloud
+addcredential
#
# End of scripts
diff --git a/ci/clean.sh b/ci/clean.sh
index 5005b59..1f3ef54 100755
--- a/ci/clean.sh
+++ b/ci/clean.sh
@@ -2,52 +2,22 @@
set -ex
-jujuver=`juju --version`
-
-if [[ "$jujuver" > "2" ]]; then
- if [ ! -d labconfig.yaml ]; then
- cp ~/joid_config/labconfig.yaml ./labconfig.yaml || true
- if [ -d $HOME/joid_config/deployconfig.yaml ]; then
- cp ~/joid_config/deployconfig.yaml ./deployconfig.yaml || true
- else
- python genDeploymentConfig.py -l labconfig.yaml > deployconfig.yaml
- fi
- fi
-else
- if [ ! -d environments.yaml ]; then
- cp ~/joid_config/environments.yaml ./environments.yaml || true
- cp ~/.juju/environments.yaml ./environments.yaml || true
- fi
-fi
-
-
-if [[ "$jujuver" > "2" ]]; then
- controllername=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml`
- cloudname=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml`
- juju destroy-controller $controllername --destroy-all-models -y || true
-# juju kill-controller $controllername --timeout 10s -y || true
- rm -rf precise
- rm -rf trusty
- rm -rf xenial
- rm -rf ~/joid_config/admin-openrc
- sleep 10
- sudo sysctl -w vm.drop_caches=3
-elif [ -d $HOME/.juju/environments ]; then
- echo " " > status.txt
- juju status &>>status.txt || true
- if [ "$(grep -c "environment is not bootstrapped" status.txt )" -ge 1 ]; then
- echo " environment is not bootstrapped ..."
+if [ ! -d labconfig.yaml ]; then
+ cp ~/joid_config/labconfig.yaml ./labconfig.yaml || true
+ if [ -d $HOME/joid_config/deployconfig.yaml ]; then
+ cp ~/joid_config/deployconfig.yaml ./deployconfig.yaml || true
else
- echo " environment is bootstrapped ..."
- jujuenv=`juju status | grep environment | cut -d ":" -f 2`
- juju destroy-environment $jujuenv -y || true
+ python genDeploymentConfig.py -l labconfig.yaml > deployconfig.yaml
fi
- rm -rf precise
- rm -rf trusty
- rm -rf xenial
- rm -rf $HOME/.juju/j*
- rm -rf $HOME/.juju/.deployer-store-cache
- rm -rf $HOME/.juju/environments
- rm -rf $HOME/.juju/ssh
- sudo sysctl -w vm.drop_caches=3
fi
+
+controllername=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml`
+cloudname=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml`
+juju destroy-controller $controllername --destroy-all-models -y || true
+#juju kill-controller $controllername --timeout 10s -y || true
+rm -rf precise
+rm -rf trusty
+rm -rf xenial
+rm -rf ~/joid_config/admin-openrc
+sleep 10
+sudo sysctl -w vm.drop_caches=3
diff --git a/ci/cleanmaas.sh b/ci/cleanmaas.sh
index 41a7419..bcb4e44 100755
--- a/ci/cleanmaas.sh
+++ b/ci/cleanmaas.sh
@@ -2,10 +2,6 @@
set -ex
-maasver=$(apt-cache policy maas | grep Installed | cut -d ':' -f 2 | sed -e 's/^[ ]*//')
-
-if [[ "$maasver" > "2" ]]; then
- echo "removing existing maas ..."
- sudo apt-get purge maas maas-cli maas-common maas-dhcp maas-dns maas-proxy maas-rack-controller maas-region-api maas-region-controller -y
- sudo rm -rf /var/lib/maas
-fi
+echo "removing existing maas ..."
+sudo apt-get purge maas maas-cli maas-common maas-dhcp maas-dns maas-proxy maas-rack-controller maas-region-api maas-region-controller -y
+sudo rm -rf /var/lib/maas
diff --git a/ci/depMAAS.py b/ci/depMAAS.py
index 5592bc4..3a16b1e 100644
--- a/ci/depMAAS.py
+++ b/ci/depMAAS.py
@@ -31,14 +31,7 @@ labconfig_file = options.lab
#
# Set Path and configs path
#
-
-# Capture our current directory
-jujuver = subprocess.check_output(["juju", "--version"])
-
-if LooseVersion(jujuver) >= LooseVersion('2'):
- TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/maas_tpl'
-else:
- TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/maas2/maas_tpl'
+TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/maas_tpl'
HOME = os.environ['HOME']
USER = os.environ['USER']
diff --git a/ci/deploy.sh b/ci/deploy.sh
index 2022b87..4c51696 100755
--- a/ci/deploy.sh
+++ b/ci/deploy.sh
@@ -227,7 +227,7 @@ deploy() {
./cleanvm.sh || true
if [ "$virtinstall" -eq 1 ]; then
- ./00-maasdeploy.sh virtual
+ ./03-maasdeploy.sh virtual
else
if [ -z "$labfile" ]; then
if [ ! -e ./labconfig.yaml ]; then
@@ -248,7 +248,7 @@ deploy() {
cp $labfile ./labconfig.yaml
fi
- ./00-maasdeploy.sh custom
+ ./03-maasdeploy.sh custom
fi
fi
@@ -318,8 +318,6 @@ juju status --format=tabular
# translate bundle.yaml to json
python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)' < bundles.yaml > bundles.json
-jujuver=`juju --version`
-
# Configuring deployment
if ([ $opnfvmodel == "openstack" ]); then
if ([ $opnfvsdn == "ocl" ]); then
@@ -339,13 +337,8 @@ if ([ $opnfvmodel == "openstack" ]); then
./openstack.sh "$opnfvsdn" "$opnfvlab" "$opnfvdistro" "$openstack" || true
# creating heat domain after pushing the public API into /etc/hosts
- if [[ "$jujuver" > "2" ]]; then
- status=`juju run-action heat/0 domain-setup`
- echo $status
- else
- status=`juju action do heat/0 domain-setup`
- echo $status
- fi
+ status=`juju run-action heat/0 domain-setup`
+ echo $status
sudo ../juju/get-cloud-images || true
../juju/joid-configure-openstack || true
diff --git a/ci/genBundle.py b/ci/genBundle.py
index 1bd09bb..ffe9cb8 100644
--- a/ci/genBundle.py
+++ b/ci/genBundle.py
@@ -35,13 +35,7 @@ labconfig_file = options.lab
#
scenarioconfig_file = 'default_deployment_config.yaml'
-# Capture our current directory
-jujuver = subprocess.check_output(["juju", "--version"])
-
-if LooseVersion(jujuver) >= LooseVersion('2'):
- TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/juju2/bundle_tpl'
-else:
- TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/bundle_tpl'
+TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/juju2/bundle_tpl'
#
# Prepare variables
diff --git a/ci/genDeploymentConfig.py b/ci/genDeploymentConfig.py
index 0a21fff..0d3a1c9 100644
--- a/ci/genDeploymentConfig.py
+++ b/ci/genDeploymentConfig.py
@@ -30,14 +30,7 @@ labconfig_file = options.lab
#
# Set Path and configs path
#
-
-# Capture our current directory
-jujuver = subprocess.check_output(["juju", "--version"])
-
-if LooseVersion(jujuver) >= LooseVersion('2'):
- TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/juju2'
-else:
- TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl'
+TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/juju2'
HOME = os.environ['HOME']
USER = os.environ['USER']
diff --git a/ci/genK8Bundle.py b/ci/genK8Bundle.py
index 2f0b63d..f0198d7 100644
--- a/ci/genK8Bundle.py
+++ b/ci/genK8Bundle.py
@@ -35,9 +35,6 @@ labconfig_file = options.lab
#
scenarioconfig_file = 'default_deployment_config.yaml'
-# Capture our current directory
-jujuver = subprocess.check_output(["juju", "--version"])
-
TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/juju2/bundlek8_tpl'
#
diff --git a/ci/genMAASConfig.py b/ci/genMAASConfig.py
index 9417f71..8a3f557 100644
--- a/ci/genMAASConfig.py
+++ b/ci/genMAASConfig.py
@@ -31,14 +31,7 @@ labconfig_file = options.lab
#
# Set Path and configs path
#
-
-# Capture our current directory
-jujuver = subprocess.check_output(["juju", "--version"])
-
-if LooseVersion(jujuver) >= LooseVersion('2'):
- TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/maas2/maas_tpl'
-else:
- TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/maas_tpl'
+TPL_DIR = os.path.dirname(os.path.abspath(__file__))+'/config_tpl/maas2/maas_tpl'
HOME = os.environ['HOME']
USER = os.environ['USER']
diff --git a/ci/openstack.sh b/ci/openstack.sh
index a32bb99..a7d91fb 100755
--- a/ci/openstack.sh
+++ b/ci/openstack.sh
@@ -17,8 +17,6 @@ opnfvlab=$2
opnfvdistro=$3
opnfvos=$4
-jujuver=`juju --version`
-
if [ -f ./deployconfig.yaml ];then
EXTERNAL_NETWORK=`grep floating-ip-range deployconfig.yaml | cut -d ' ' -f 4 `
@@ -49,38 +47,22 @@ update_gw_mac() {
## get gateway mac
EXTNET_GW_MAC=$(juju ssh nova-compute/0 "arp -a ${EXTNET_GW} | grep -Eo '([0-9a-fA-F]{2})(([/\s:-][0-9a-fA-F]{2}){5})'")
## set external gateway mac in onos
- if [[ "$jujuver" < "2" ]]; then
- juju set onos-controller gateway-mac=$EXTNET_GW_MAC
- else
- juju config onos-controller gateway-mac=$EXTNET_GW_MAC
- fi
+ juju config onos-controller gateway-mac=$EXTNET_GW_MAC
}
unitAddress() {
- if [[ "$jujuver" < "2" ]]; then
- juju status --format yaml | python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"services\"][\"$1\"][\"units\"][\"$1/$2\"][\"public-address\"]" 2> /dev/null
- else
- juju status --format yaml | python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"applications\"][\"$1\"][\"units\"][\"$1/$2\"][\"public-address\"]" 2> /dev/null
- fi
+ juju status --format yaml | python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"applications\"][\"$1\"][\"units\"][\"$1/$2\"][\"public-address\"]" 2> /dev/null
}
unitMachine() {
- if [[ "$jujuver" < "2" ]]; then
- juju status --format yaml | python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"services\"][\"$1\"][\"units\"][\"$1/$2\"][\"machine\"]" 2> /dev/null
- else
- juju status --format yaml | python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"applications\"][\"$1\"][\"units\"][\"$1/$2\"][\"machine\"]" 2> /dev/null
- fi
+ juju status --format yaml | python -c "import yaml; import sys; print yaml.load(sys.stdin)[\"applications\"][\"$1\"][\"units\"][\"$1/$2\"][\"machine\"]" 2> /dev/null
}
keystoneIp() {
if [ $(juju status keystone --format=short | grep " keystone"|wc -l) == 1 ];then
unitAddress keystone 0
else
- if [[ "$jujuver" < "2" ]]; then
- juju get keystone | python -c "import yaml; import sys; print yaml.load(sys.stdin)['settings']['vip']['value']" | cut -d " " -f 1
- else
- juju config keystone | python -c "import yaml; import sys; print yaml.load(sys.stdin)['settings']['vip']['value']" | cut -d " " -f 1
- fi
+ juju config keystone | python -c "import yaml; import sys; print yaml.load(sys.stdin)['settings']['vip']['value']" | cut -d " " -f 1
fi
}
@@ -90,11 +72,7 @@ create_openrc() {
mkdir -m 0700 -p cloud
keystoneIp=$(keystoneIp)
- if [[ "$jujuver" < "2" ]]; then
- adminPasswd=$(juju get keystone | grep admin-password -A 5 | grep value | awk '{print $2}' 2> /dev/null)
- else
- adminPasswd=$(juju config keystone | grep admin-password -A 5 | grep value | awk '{print $2}' 2> /dev/null)
- fi
+ adminPasswd=$(juju config keystone | grep admin-password -A 5 | grep value | awk '{print $2}' 2> /dev/null)
v3api=`juju config keystone preferred-api-version`