Merge "Add odl-sxp-routing feature to distribution"
[releng/builder.git] / packer / provision / devstack-pre-pip.sh
index a91d7619d68d843467b6a73d0153f402bf5189e9..43788d77f2c279f9e25a3321dd7c3023a84b1dcd 100644 (file)
@@ -22,7 +22,10 @@ fi
 
 echo '---> Pre-installing yum and pip packages'
 projs="requirements keystone glance cinder neutron nova horizon"
+# shellcheck disable=SC2154
 branch=${os_branch}
+# strip the "stable" off of the branch
+branch_name=$(cut -d'/' -f2 <<< "${branch}")
 
 wget https://bootstrap.pypa.io/get-pip.py
 python get-pip.py
@@ -31,31 +34,36 @@ mkdir tmp
 cd tmp
 
 git clone https://github.com/openstack-dev/devstack.git
-(cd devstack && git checkout ${branch})
+(cd devstack && git checkout "${branch}")
 sed -e 's/#.*//' devstack/files/rpms/general | xargs yum install -y
 
+sudo ls -al /usr/lib/py*
+
+sudo rm -rf /usr/lib/python3/dist-packages/yaml
+sudo rm -rf /usr/lib/python3/dist-packages/PyYAML-*
+sudo rm -rf /usr/lib/python3.4/dist-packages/yaml
+sudo rm -rf /usr/lib/python3.4/dist-packages/PyYAML-*
+
+sudo rm -rf /usr/lib/python3/site-packages/yaml
+sudo rm -rf /usr/lib/python3/site-packages/PyYAML-*
+sudo rm -rf /usr/lib/python3.4/site-packages/yaml
+sudo rm -rf /usr/lib/python3.4/site-packages/PyYAML-*
+
 base_url=https://github.com/openstack/
 for proj in $projs
 do
-    git clone ${base_url}${proj}
-    (cd ${proj} && git checkout ${branch})
-    pip install -c requirements/upper-constraints.txt -e ${proj}
-    pip install -c requirements/upper-constraints.txt -r ${proj}/test-requirements.txt
+    git clone "${base_url}${proj}"
+    (cd "${proj}" && git checkout "${branch}")
+    pip install -c requirements/upper-constraints.txt -e "${proj}"
+    pip install -c requirements/upper-constraints.txt -r "${proj}/test-requirements.txt"
 done
 
-if [ "$branch" == "stable/mitaka" ] || [ "$branch" == "stable/liberty" ]; then
-    # the newton release has ovs 2.5.0
-    echo '---> Installing openvswitch from openstack Newton repo (2.5.0)'
-    yum install -y http://rdoproject.org/repos/openstack-newton/rdo-release-newton.rpm
-else
-    # the ocata release has ovs 2.6.1
-    echo '---> Installing openvswitch from openstack Ocata repo (2.6.1)'
-    yum install -y http://rdoproject.org/repos/openstack-ocata/rdo-release-ocata.rpm
-fi
+echo '---> Installing openvswitch from relevant openstack branch'
+yum install -y "centos-release-openstack-${branch_name}"
 
 yum install -y --nogpgcheck openvswitch
 
-cd $OLDPWD
+cd "$OLDPWD"
 rm -fr tmp
 
 # vim: sw=4 ts=4 sts=4 et :