instack-undercloud/scripts/instack-install-undercloud-...

215 lines
5.9 KiB
Bash
Executable File

#!/bin/bash
set -eux
export INSTACK_ROOT=${INSTACK_ROOT:-$(pwd)}
export ELEMENTS_PATH="$INSTACK_ROOT/tripleo-image-elements/elements:$INSTACK_ROOT/diskimage-builder/elements:$INSTACK_ROOT/instack-undercloud/elements"
export JSONFILE=${JSONFILE:-$INSTACK_ROOT/instack-undercloud/json-files/fedora-20-undercloud-source.json}
if [ "$DELOREAN" = "1" ]; then
sudo curl -o /etc/yum.repos.d/delorean.repo $DELOREAN_REPO
sudo curl -o /etc/yum.repos.d/delorean-alt.repo $DELOREAN_REPO_ALT
sudo sed -i "s/delorean/delorean-alt/g" /etc/yum.repos.d/delorean-alt.repo
export JSONFILE=$INSTACK_ROOT/instack-undercloud/json-files/fedora-20-undercloud-delorean.json
fi
sudo yum -y install git python-pip ccache
source /etc/profile.d/ccache.sh
mkdir -p $PIP_DOWNLOAD_CACHE
git config --global user.email "instack@example.com"
git config --global user.name "instack"
if [ ! -d $INSTACK_ROOT/tripleo-image-elements/elements ]; then
git clone https://git.openstack.org/openstack/tripleo-image-elements
pushd tripleo-image-elements
if [ "$LKG" = "1" ]; then
git fetch origin $DIB_REPOREF_tripleo_image_elements
git reset --hard FETCH_HEAD
fi
popd
fi
if [ ! -d $INSTACK_ROOT/diskimage-builder ]; then
git clone https://git.openstack.org/openstack/diskimage-builder
pushd diskimage-builder
if [ "$LKG" = "1" ]; then
git fetch origin $DIB_REPOREF_diskimage_builder
git reset --hard FETCH_HEAD
fi
popd
fi
if [ ! -d "$INSTACK_ROOT/dib-utils" ]; then
git clone https://git.openstack.org/openstack/dib-utils
fi
if [ ! -d $INSTACK_ROOT/instack-undercloud ]; then
git clone https://github.com/agroup/instack-undercloud
fi
if [ ! -d $INSTACK_ROOT/instack ]; then
git clone https://github.com/agroup/instack
fi
if [ ! -d $INSTACK_ROOT/os-cloud-config ]; then
git clone https://git.openstack.org/openstack/os-cloud-config
pushd os-cloud-config
if [ "$LKG" = "1" ]; then
git fetch origin $DIB_REPOREF_os_cloud_config
git reset --hard FETCH_HEAD
fi
# Reset to before requirements.txt update from
# https://review.openstack.org/#/c/106589/
# Not yet sure why this is failing to install.
git reset --hard 4a03e6b129c91a7269b6103a1f85fd011ec92c91
popd
fi
if [ ! -d $INSTACK_ROOT/tripleo-incubator ]; then
git clone https://git.openstack.org/openstack/tripleo-incubator
pushd tripleo-incubator
if [ "$LKG" = "1" ]; then
git fetch origin $DIB_REPOREF_tripleo_incubator
git reset --hard FETCH_HEAD
fi
## create-nodes x86_64 support
#
# https://review.openstack.org/#/c/123803/
git fetch https://review.openstack.org/openstack/tripleo-incubator refs/changes/03/123803/2 && git cherry-pick FETCH_HEAD
popd
fi
if [ ! -d $INSTACK_ROOT/tripleo-heat-templates ]; then
git clone https://git.openstack.org/openstack/tripleo-heat-templates
# Create an unpatched copy for non-Tuskar testing
cp -r $INSTACK_ROOT/tripleo-heat-templates $INSTACK_ROOT/tripleo-heat-templates-instack
pushd tripleo-heat-templates
## No merge.py for the overcloud
#
# https://review.openstack.org/#/c/123100
git fetch https://review.openstack.org/openstack/tripleo-heat-templates refs/changes/00/123100/2 && git cherry-pick FETCH_HEAD
popd
fi
export DIB_REPOLOCATION_tripleo_heat_templates=$INSTACK_ROOT/tripleo-heat-templates
if [ ! -d $INSTACK_ROOT/tuskar-ui ]; then
git clone https://git.openstack.org/openstack/tuskar-ui
export DIB_REPOLOCATION_tuskar_ui=$INSTACK_ROOT/tuskar-ui
fi
export DIB_REPOLOCATION_tuskar_ui=$INSTACK_ROOT/tuskar-ui
pushd $INSTACK_ROOT/dib-utils
sudo pip install -U .
popd
pushd $INSTACK_ROOT/diskimage-builder
sudo pip install -U .
popd
pushd $INSTACK_ROOT/instack
sudo pip install -e .
popd
# Needed to compile os-cloud-config
sudo yum install -y libffi-devel gcc python-devel openssl-devel libxml2-devel libxslt-devel
pushd $INSTACK_ROOT/os-cloud-config
sudo pip install -e .
popd
# tar is required if we want to run diskimage-builder
sudo yum install -y tar
# needed for semanage
sudo yum install -y policycoreutils-python
# ensure latest policy
sudo yum install -y selinux-policy
if [ "$RUN_INSTACK" -eq 0 ]; then
echo "Exiting without running instack."
exit 0
fi
$INSTACK_ROOT/instack-undercloud/scripts/instack-install-undercloud-packages
if [ "$DELOREAN" -eq 1 ]; then
sudo yum -y install \
https://athomas.fedorapeople.org/ironic/fedora20/openstack-ironic-api-2014.0923-2.noarch.rpm \
https://athomas.fedorapeople.org/ironic/fedora20/openstack-ironic-common-2014.0923-2.noarch.rpm \
https://athomas.fedorapeople.org/ironic/fedora20/openstack-ironic-conductor-2014.0923-2.noarch.rpm
# No update for python-paramiko yet, so update it via pip.
# https://bugzilla.redhat.com/show_bug.cgi?id=1139319
sudo pip install -U paramiko
# We also need newer eventlet. This is already packaged upstream in Juno,
# so no need to file a bug on this one.
sudo pip install -U eventlet
# This has been fixed in Delorean, just need to wait for a new Ironic build.
sudo /bin/bash -c "
cat > /etc/sudoers.d/ironic <<EOF
Defaults:ironic !requiretty
ironic ALL = (root) NOPASSWD: /usr/bin/ironic-rootwrap /etc/ironic/rootwrap.conf *
EOF
"
# Need to restart ironic conductor to pick up the new code
sudo systemctl restart openstack-ironic-conductor || true
# python-swiftclient requires python-futures
sudo yum -y install python-futures
fi
if [ "$LKG" -eq 1 -a "$DELOREAN" -eq "0" ]; then
# Heat's requirements for LKG cause issues
sudo /opt/stack/venvs/openstack/bin/pip install -U "sqlalchemy-migrate!=0.9.2"
sudo systemctl restart heat-engine
fi
# Reset ownership of cache directory
# This is needed in order for instack-build-images to make changes to the cache
# $USER is not always set in a live cd building enviroment, so use || true
sudo -E chown -R $USER: $HOME/.cache/image-create || true
echo "$COMPLETION_MESSAGE"