284 lines
9.6 KiB
Bash
Executable File
284 lines
9.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -eux
|
|
|
|
export INSTACK_ROOT=${INSTACK_ROOT:-"/usr/share"}
|
|
export ELEMENTS_PATH=${ELEMENTS_PATH:-"\
|
|
/usr/share/tripleo-image-elements:\
|
|
/usr/share/diskimage-builder/elements:\
|
|
/usr/share/instack-undercloud"}
|
|
export JSONFILE=${JSONFILE:-/usr/share/instack-undercloud/json-files/fedora-20-undercloud-delorean.json}
|
|
|
|
source "$INSTACK_ROOT"/instack-undercloud/instack-sourcerc
|
|
|
|
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
|
|
sudo /bin/bash -c "echo >> /etc/yum.repos.d/delorean.repo"
|
|
sudo /bin/bash -c "echo 'exclude=openstack-tripleo openstack-tripleo-image-elements openstack-tripleo-heat-templates diskimage-builder dib-utils os-cloud-config openstack-ironic-api openstack-ironic-common openstack-ironic-conductor' >> /etc/yum.repos.d/delorean.repo"
|
|
sudo /bin/bash -c "echo >> /etc/yum.repos.d/delorean-alt.repo"
|
|
sudo /bin/bash -c "echo 'exclude=openstack-tripleo openstack-tripleo-image-elements openstack-tripleo-heat-templates diskimage-builder dib-utils os-cloud-config openstack-ironic-api openstack-ironic-common openstack-ironic-conductor' >> /etc/yum.repos.d/delorean-alt.repo"
|
|
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"
|
|
|
|
function cherry_pick {
|
|
local PROJ_NAME=$1
|
|
local REFSPEC=$2
|
|
|
|
pushd $PROJ_NAME
|
|
git fetch https://review.openstack.org/openstack/$PROJ_NAME "$REFSPEC"
|
|
git cherry-pick FETCH_HEAD
|
|
popd
|
|
}
|
|
|
|
function do_tripleo_source_installs {
|
|
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
|
|
|
|
# This patch is RDO specific, as such there is no upstream review for it.
|
|
# Change default swift ports
|
|
git fetch https://github.com/redhat-openstack/tripleo-image-elements
|
|
git cherry-pick 9a73b8a1cf8cdf23cbf065358532210c66dcdb40
|
|
|
|
popd
|
|
|
|
# disable keepalived custom policy on RHEL because it doesn't install
|
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1151647
|
|
export NODE_DIST=${NODE_DIST:-fedora}
|
|
if [[ "$NODE_DIST" =~ "centos" || "$NODE_DIST" =~ "rhel" ]]; then
|
|
rm $INSTACK_ROOT/tripleo-image-elements/elements/selinux/custom-policies/tripleo-selinux-keepalived.te
|
|
fi
|
|
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
|
|
|
|
# Install openstack-selinux on RHEL
|
|
cherry_pick diskimage-builder refs/changes/65/123865/3
|
|
|
|
# fix epel repo url
|
|
# https://review.openstack.org/#/c/125552/
|
|
# https://review.openstack.org/#/c/125450/
|
|
# https://review.openstack.org/#/c/127304/
|
|
cherry_pick diskimage-builder refs/changes/52/125552/1
|
|
cherry_pick diskimage-builder refs/changes/50/125450/4
|
|
cherry_pick diskimage-builder refs/changes/04/127304/1
|
|
fi
|
|
|
|
# tar is required if we want to run diskimage-builder
|
|
sudo yum install -y tar
|
|
|
|
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
|
|
|
|
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
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
if [ ! -d $INSTACK_ROOT/tripleo-heat-templates ]; then
|
|
git clone https://git.openstack.org/openstack/tripleo-heat-templates
|
|
|
|
## Compute and controller templates without merge.py + Add converted version of block and object storage
|
|
#
|
|
# https://review.openstack.org/#/c/123100
|
|
cherry_pick tripleo-heat-templates refs/changes/00/123100/7
|
|
# https://review.openstack.org/#/c/123713/
|
|
cherry_pick tripleo-heat-templates refs/changes/13/123713/10
|
|
# https://review.openstack.org/#/c/126562
|
|
cherry_pick tripleo-heat-templates refs/changes/62/126562/2
|
|
|
|
|
|
fi
|
|
|
|
# Create a useful symlink for openstack-tripleo-heat-templates
|
|
# This simplifies the source vs package installs a bit so we can just use one path
|
|
ln -f -s $INSTACK_ROOT/tripleo-heat-templates $INSTACK_ROOT/openstack-tripleo-heat-templates
|
|
|
|
export DIB_REPOLOCATION_tripleo_heat_templates=$INSTACK_ROOT/tripleo-heat-templates
|
|
export DIB_INSTALLTYPE_tripleo_heat_templates=source
|
|
export TUSKAR_ROLE_DIRECTORY=/opt/stack/tripleo-heat-templates
|
|
|
|
# pip installs netaddr package as one of dependencies when
|
|
# installing instack-related projects bellow. Then later
|
|
# python-netaddr rpm is being installed and it fails on RHEL
|
|
# because it conflicts with pip's netaddr. Make sure python-netaddr
|
|
# rpm is installed first.
|
|
sudo yum -y install python-netaddr
|
|
|
|
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
|
|
|
|
# Must uninstall cmd2 otherwise, the package install will fail later on
|
|
sudo pip uninstall -y cmd2
|
|
|
|
}
|
|
|
|
if [ ! -d $INSTACK_ROOT/tuskar-ui ]; then
|
|
|
|
sudo git clone https://git.openstack.org/openstack/tuskar-ui $INSTACK_ROOT/tuskar-ui
|
|
|
|
fi
|
|
|
|
export DIB_REPOLOCATION_tuskar_ui=$INSTACK_ROOT/tuskar-ui
|
|
|
|
if [ "$INSTACK_TRIPLEO_SOURCE" = "1" ]; then
|
|
do_tripleo_source_installs
|
|
else
|
|
# Need to update to newer tripleo packages until we get more recent releases
|
|
sudo yum -y update openstack-tripleo-image-elements
|
|
sudo yum -y update diskimage-builder
|
|
# Make sure we don't end up with older oslo config from Fedora 20.
|
|
sudo yum -y update python-oslo-config
|
|
export TUSKAR_ROLE_DIRECTORY=/usr/share/openstack-tripleo-heat-templates
|
|
fi
|
|
|
|
# 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
|
|
|
|
if [ "$DELOREAN" -eq 1 ]; then
|
|
|
|
# Must delete any newer packages first
|
|
sudo yum -y erase openstack-ironic-common
|
|
|
|
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
|
|
|
|
sudo yum install -y libffi-devel gcc python-devel openssl-devel libxml2-devel libxslt-devel
|
|
|
|
# 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
|
|
"
|
|
sudo chmod 0440 /etc/sudoers.d/ironic
|
|
|
|
# python-swiftclient requires python-futures
|
|
sudo yum -y install python-futures
|
|
|
|
fi
|
|
|
|
instack-install-undercloud
|
|
|
|
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
|
|
|
|
# svc-map requires PyYAML, need to submit this patch upstream
|
|
sudo yum -y install PyYAML
|
|
|
|
# Must erase NetworkManager, otherwise ifup called on the provisioning
|
|
# interface tries to use nmcli and that fails for some yet undetermined reason,
|
|
# so just delete NetworkManager for now.
|
|
sudo yum -y erase NetworkManager
|
|
|
|
# Must reinstall cmd2 as there is a package conflict with the pip install, so
|
|
# we have to reinstall it. Otherwise, "neturon net-show" during
|
|
# instack-deploy-overcloud fails.
|
|
sudo pip install -U cmd2
|
|
|
|
echo "$COMPLETION_MESSAGE"
|